{"version":3,"sources":["remotes/services.js","components/Attribute.js","components/ProductDetails.js","actions/actions.js","i18n.js","App.js","serviceWorker.js","reducers/cart.js","store.js","index.js"],"names":["lang","window","baseURL","storeBaseURL","cem_key","token","clientToken","reGenerateTokenUrl","reGenerateToken","storeServerURL","defaultHeaders","params","axiosApiInstance","axios","create","interceptors","request","use","_ref","Object","asyncToGenerator","_regeneratorRuntime","mark","_callee","config","wrap","_context","prev","next","console","log","headers","Authorization","abrupt","stop","_x","apply","this","arguments","err","response","_ref2","_callee2","_context2","_x2","error","data","code","Promise","resolve","reject","fetch","method","Content-type","cem-key","then","res","text","result","catch","JSON","stringify","oldRequest","objectSpread","document","location","href","concat","getProductDetailsBySKU","sku","get","getProductVariationsById","product_id","addItemsToCart","cart_key","quantity","variation_id","addOn","length","undefined","field_name","value","post","updateItem","cart_item_key","Attribute","props","_this","classCallCheck","possibleConstructorReturn","getPrototypeOf","call","state","attributeId","attributeName","attributeOptions","selectedButtons","enabledAttributeOptions","buttonOptionsColor","optionColors","_this2","enabledAttributes","attribute","t","react_default","a","createElement","className","divider","orientation","style","display","flexWrap","map","item","i","toLowerCase","includes","key","es_button","shape","disabled","background","borderColor","borderWidth","width","height","opacity","onClick","e","buttonClickHandler","marginTop","color","Component","withTranslation","Option","Select","offers","name","id","radioStyle","lineHeight","ProductDetails","getProductDetailsBySKUFn","setState","loading","status","openNotification","statusText","meta_data","forEach","_wc_pre_orders_enabled","unix_timestamp","date","Date","formattedTime","getDate","getMonth","getFullYear","_wc_pre_orders_availability_datetime","productImage","images","src","addons","attributes","productId","productName","getProductVariations","message","variations","filter","variation","in_stock","newFilters","options","stockAvailable","filters","onFindVariation","onFilterPress","event","imageUrl","getProductImageUrl","price","variationId","cartIsDisabled","getChoosenAttributesCount","onUpdateAttributes","matching_variations","findMatchingVariations","eshop_price","cartDisabled","allAttributes","assign","index","currentAttributes","current_attr_name","new_attr_select","str","checkAttributes","num","variationAttributes","attr","attr_val","option","option_elements","len","na","matching","isMatch","push","variation_attributes","match","attr_name","val1","val2","filterCount","type","desc","notification","description","redirect","cart","uuidv4","selectedOption","counter","sessionStorage","po_error_msg","storeCartURL","localStorage","cartKey","addToCart","image","stock_quantity","product_type","celebrusSku","doShoppingCartAction","offer_id","goToOffer","scrollTo","top","behavior","updateProductItem","storeOffersURL","onChange","appleCarePrice","target","parseFloat","j","renderProductDetails","_this$state","totalPrice","spin","spinning","size","row","col","marginBottom","fontSize","fontWeight","components_Attribute","hex_options","fontStyle","dangerouslySetInnerHTML","__html","es_form","Item","es_radio","Group","buttonStyle","checked","label","es_select","defaultValue","placeholder","right","borderTopLeftRadius","left","flexDirection","borderTopRightRadius","statistic","title","suffix","icon","ShoppingCartOutlined","matches","position","alt","connect","dispatch","product","p","product_name","capacity","line_total","lng","storageLanguage","getItem","indexOf","i18n","XHR","initReactI18next","init","debug","keySeparator","interpolation","escapeValue","fallbackLng","backend","loadPath","allowMultiLoading","react","wait","useSuspense","errorPage","errorPageURL","App","search","URLSearchParams","val","prototype","toString","r","f","isEmpty","getParameter","components_ProductDetails","Boolean","hostname","action","parse","setItem","exists","changed","store","createStore","combineReducers","applyMiddleware","thunk","getState","ReactDOM","render","es","fallback","config_provider","direction","src_App","getElementById","navigator","serviceWorker","ready","registration","unregister"],"mappings":"qpNAQA,IAAMA,EAAOC,OAAOD,KACdE,EAAUD,OAAOE,aACjBC,EAAUH,OAAM,QAElBI,EAAQJ,OAAOK,YACfC,EAAqBN,OAAOO,gBAC5BC,EAAiBR,OAAOQ,eAExBC,EAAiB,CACnBC,OAAQ,IAGJC,EAAmBC,IAAMC,SAE/BF,EAAiBG,aAAaC,QAAQC,IAAtC,eAAAC,EAAAC,OAAAC,EAAA,EAAAD,CAAAE,IAAAC,KACE,SAAAC,EAAOC,GAAP,OAAAH,IAAAI,KAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,cACEC,QAAQC,IAAI,oBACZN,EAAOO,QAAQC,cAAgB,UAAY3B,EAC3Cm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AOH,OCbTmR,GAAM7C,SNuCG,CACLxE,KAAM,uBMtCV2H,IAASC,OACP5O,EAAAC,EAAAC,cAAC2O,EAAA,EAAD,CAAUR,MAAOA,IACfrO,EAAAC,EAAAC,cAAC4M,EAAA,SAAD,CAAUgC,SAAU9O,EAAAC,EAAAC,cAAA,aAClBF,EAAAC,EAAAC,cAAC6O,GAAA,EAAD,CAAgBC,UAA2B,OAAhBvV,OAAOD,KAAgB,MAAQ,OACxDwG,EAAAC,EAAAC,cAAC+O,GAAD,SAINzR,SAAS0R,eAAe,SHqGpB,kBAAmBC,WACrBA,UAAUC,cAAcC,MAAMtS,KAAK,SAACuS,GAClCA,EAAaC","file":"static/js/main.c0c9ba8c.chunk.js","sourcesContent":["import axios from \"axios/index\";\r\n// window.storeBaseURL = \"https://api.mobily.com.sa/apis/eshop\";\r\n// window.clientToken = \"5Ii1oovxRSQCXINrZqvXuKZDQg3Y\";\r\n// // window.sessionStorage.sku = \"TEST_PO\";\r\n// window.sessionStorage.sku =\"iPhn13Pro\"\r\n// window.reGenerateToken =\r\n// \"/wps/portal/web/personal/store/track-order/!ut/p/z1/jZDJDoIwFEW_xS_obWkYlqWQMCmWBsRuTFcGo2iM8ftloQuJIG_3knPuG4ghLTG9fXZH--iuvT0P_d64h5TmMsk42_puA6goCDKxAc01JbtvoETlQCU85FKWzEkZMUt8V0UxctABgA9VFzL01x6F8Jb5mCiB_74ZIZWIoAo0ShcRjbX3BqZWZGyc8OMHswniM2LmCm3v5Hap6xZdeuJi9QK-OGib/dz/d5/L2dBISEvZ0FBIS9nQSEh/p0/IZ7_6A52G301P02H10QT8H4TPI00T7=CZ6_I1KCHJ42P86V00QD99JAN01KS1=NJreGenerateToken=/\";\r\n// window.lang=\"en\"\r\nconst lang = window.lang;\r\nconst baseURL = window.storeBaseURL;\r\nconst cem_key = window[\"CEM_KEY\"];\r\n\r\nvar token = window.clientToken;\r\nvar reGenerateTokenUrl = window.reGenerateToken;\r\nvar storeServerURL = window.storeServerURL;\r\n\r\nlet defaultHeaders = {\r\n params: {},\r\n};\r\n\r\nconst axiosApiInstance = axios.create();\r\n\r\naxiosApiInstance.interceptors.request.use(\r\n async (config) => {\r\n console.log(\"axiosApiInstance\");\r\n config.headers.Authorization = \"Bearer \" + token;\r\n config.headers[\"cem-key\"] = cem_key;\r\n return config;\r\n },\r\n (err) => {\r\n console.log(\"error in getting \", err);\r\n return err;\r\n }\r\n);\r\naxiosApiInstance.interceptors.response.use(\r\n async (response) => {\r\n return response;\r\n },\r\n (error) => {\r\n if (\r\n (error.response.data.code && error.response.data.code === \"APIGEE-001\") ||\r\n (error.response.data.code && error.response.data.code === \"APIGEE-002\")\r\n ) {\r\n token = reGenerateToken();\r\n console.log(\r\n \"in response error interceptors\",\r\n JSON.stringify(error.response.config)\r\n );\r\n const { config: oldRequest } = error.response;\r\n\r\n return axiosApiInstance.request({ ...oldRequest });\r\n }\r\n if (error.response.data.code === \"cocart_add_item_pre_order_cannot_add\") {\r\n return error;\r\n }\r\n document.location.href = `/wps/portal/web/personal/store/error?errorSource=${\r\n window.lang === \"en\" ? \"Store\" : \"المتجر\"\r\n }`;\r\n return error;\r\n }\r\n);\r\n\r\nfunction reGenerateToken() {\r\n console.log(\"reGenerateToken :: Enter\");\r\n console.log(\"reGenerateTokenUrl => \" + reGenerateTokenUrl);\r\n\r\n return new Promise((resolve, reject) => {\r\n fetch(storeServerURL + \"\" + reGenerateTokenUrl, {\r\n method: \"GET\",\r\n headers: {\r\n \"Content-type\": \"text/html; charset=UTF-8\",\r\n \"cem-key\": cem_key,\r\n },\r\n })\r\n .then((res) => res.text())\r\n\r\n .then((result) => {\r\n //console.log(\"Token res -> \"+result);\r\n resolve(result);\r\n })\r\n .catch((err) => {\r\n //console.log(err);\r\n reject(err);\r\n });\r\n });\r\n}\r\n\r\n/**\r\n * Retrieves product details with sku given as parameter\r\n * @param sku\r\n * @returns {AxiosPromise}\r\n */\r\nconst getProductDetailsBySKU = (sku) => {\r\n return axiosApiInstance.get(\r\n `${baseURL}/wp-json/wc/v3/products?lang=${lang}&sku=${sku}`,\r\n defaultHeaders\r\n );\r\n};\r\n\r\n/**\r\n * Retrieves product details with product_id given as parameter\r\n * @param product_id\r\n * @returns {AxiosPromise}\r\n */\r\nconst getProductVariationsById = (product_id) => {\r\n return axiosApiInstance.get(\r\n `${baseURL}/wp-json/wc/v2/products/${product_id}/variations?lang=${lang}&per_page=100`,\r\n defaultHeaders\r\n );\r\n};\r\n\r\n/**\r\n * Add items to cart for checkout\r\n * @returns {AxiosPromise}\r\n */\r\nconst addItemsToCart = (\r\n cart_key,\r\n product_id,\r\n quantity,\r\n variation_id,\r\n addOn = \"\",\r\n field_name = \"\"\r\n) => {\r\n let data = {\r\n product_id: product_id,\r\n variation_id: variation_id,\r\n quantity: 1,\r\n };\r\n if (addOn !== \"\") {\r\n data[\"product_addons\"] = [\r\n {\r\n field_name: field_name,\r\n value: addOn.value,\r\n },\r\n ];\r\n }\r\n return axiosApiInstance.post(\r\n `${baseURL}/wp-json/cocart/v1/add-item?lang=${lang}&cart_key=${cart_key}`,\r\n data,\r\n defaultHeaders\r\n );\r\n};\r\n\r\n/**\r\n * Retrieves amount details with cart_key given as parameter\r\n * @param cart_key\r\n * @returns {AxiosPromise}\r\n */\r\nconst getCartTotal = (cart_key) => {\r\n return axiosApiInstance.get(\r\n `${baseURL}/wp-json/cocart/v1/totals?lang=${lang}&cart_key=${cart_key}`,\r\n defaultHeaders\r\n );\r\n};\r\n\r\n/**\r\n * Update item\r\n * @returns {AxiosPromise}\r\n */\r\nconst updateItem = (quantity, cart_key, cart_item_key) => {\r\n console.log(\" update item \");\r\n let data = {\r\n cart_item_key: cart_item_key,\r\n quantity: quantity,\r\n };\r\n return axiosApiInstance.post(\r\n `${baseURL}/wp-json/cocart/v1/item?lang=${lang}&cart_key=${cart_key}`,\r\n data,\r\n defaultHeaders\r\n );\r\n};\r\n\r\nexport {\r\n getProductVariationsById,\r\n addItemsToCart,\r\n getProductDetailsBySKU,\r\n getCartTotal,\r\n updateItem,\r\n};\r\n","import React, { Component } from \"react\";\r\nimport { Button, Divider } from 'antd';\r\nimport { withTranslation } from \"react-i18next\";\r\nconst lang = window.lang;\r\n\r\nclass Attribute extends Component {\r\n\r\n constructor(props) {\r\n super(props);\r\n this.state = {\r\n attributeId: this.props.attributeId,\r\n attributeName: this.props.attributeName,\r\n attributeOptions: this.props.attributeOptions,\r\n selectedButtons: this.props.selectedButtons,\r\n enabledAttributeOptions: this.props.enabledAttributeOptions,\r\n buttonOptionsColor: this.props.optionColors,\r\n }\r\n }\r\n\r\n static getDerivedStateFromProps(props, state) {\r\n if (props.enabledAttributeOptions !== state.enabledAttributeOptions) {\r\n return {\r\n enabledAttributeOptions: props.enabledAttributeOptions\r\n };\r\n }\r\n if (props.selectedButtons !== state.selectedButtons) {\r\n return {\r\n selectedButtons: props.selectedButtons\r\n };\r\n }\r\n return null;\r\n }\r\n\r\n render() {\r\n let enabledAttributes = this.state.enabledAttributeOptions[this.props.attributeName];\r\n let attribute = this.state.attributeName;\r\n let selectedButtons = this.state.selectedButtons;\r\n const { t } = this.props;\r\n\r\n return (\r\n
\r\n

\r\n {attribute}\r\n

\r\n\r\n {(attribute === 'Deliver to City') ? ({t(\"delivery_hint\")}) : null}\r\n\r\n
\r\n {\r\n this.state.attributeOptions.map((item, i) => {\r\n if (attribute.toLowerCase().includes('color')||attribute.toLowerCase().includes('اللون')) {\r\n return (\r\n
\r\n \r\n
{item}
\r\n
\r\n )\r\n } else {\r\n return (\r\n
\r\n \r\n
\r\n )\r\n }\r\n })\r\n }\r\n
\r\n
\r\n )\r\n }\r\n}\r\n\r\nexport default withTranslation()(Attribute);","import React, { Component } from \"react\";\r\nimport {\r\n Spin,\r\n Button,\r\n Row,\r\n Col,\r\n Statistic,\r\n notification,\r\n Select,\r\n Radio,\r\n Form,\r\n} from \"antd\";\r\n\r\nimport {\r\n ShoppingCartOutlined,\r\n} from \"@ant-design/icons\";\r\n\r\nimport { connect } from \"react-redux\";\r\nimport { addToCart, updateProductItem } from \"../actions/actions\";\r\nimport {\r\n getProductVariationsById,\r\n addItemsToCart,\r\n getProductDetailsBySKU,\r\n getCartTotal,\r\n updateItem,\r\n} from \"../remotes/services\";\r\nimport { withTranslation } from \"react-i18next\";\r\nimport { v4 as uuidv4 } from \"uuid\";\r\nimport Attribute from \"./Attribute\";\r\n\r\nconst lang = window.lang;\r\nconst { Option } = Select;\r\nconst offers = [\r\n { name: \"no_offer\", id: null },\r\n { name: \"Raqi_Offer\", id: \"121146\" },\r\n { name: \"Wajid_Extra_Offer\", id: \"468413\" },\r\n { name: \"Wajid_Smart_Offer\", id: \"468486\" },\r\n { name: \"Wajid_Plus_Offer\", id: \"475757\" },\r\n];\r\nconst radioStyle = {\r\n display: \"block\",\r\n lineHeight: \"30px\",\r\n};\r\n\r\nclass ProductDetails extends Component {\r\n constructor(props, state) {\r\n super(props, state);\r\n this.state = {\r\n loading: false,\r\n counter: 1,\r\n attributes: [],\r\n options: [],\r\n filters: {},\r\n matches: [],\r\n addons: [],\r\n productId: -1,\r\n variationId: '',\r\n productName: '',\r\n productImage: '',\r\n price: \"\",\r\n appleCarePrice: 0,\r\n sku: \"\",\r\n stockAvailable: true,\r\n enabledAttributeOptions: {},\r\n cartDisabled: true,\r\n offer_id: null,\r\n _wc_pre_orders_enabled: false,\r\n _wc_pre_orders_availability_datetime: 0,\r\n selectedOption: \"\",\r\n };\r\n }\r\n\r\n componentDidMount() {\r\n let sku = this.props.sku;\r\n this.getProductDetailsBySKUFn(sku);\r\n }\r\n\r\n getProductDetailsBySKUFn = (sku) => {\r\n this.setState({\r\n loading: true,\r\n });\r\n getProductDetailsBySKU(sku)\r\n .then((response) => {\r\n if (response.status !== 200 && response.status !== 201) {\r\n this.openNotification(\"error\", response.status, response.statusText);\r\n this.setState({\r\n loading: false,\r\n });\r\n }\r\n \r\n response.data[0].meta_data.forEach((item) => {\r\n if (item.key === \"_wc_pre_orders_enabled\" && item.value === \"yes\") {\r\n this.setState({ _wc_pre_orders_enabled: true });\r\n }\r\n if (item.key === \"_wc_pre_orders_availability_datetime\") {\r\n let unix_timestamp = item.value;\r\n var date = new Date(unix_timestamp * 1000);\r\n var day = date.getDate();\r\n let month = date.getMonth() + 1;\r\n let year = date.getFullYear();\r\n let formattedTime = day + \"/\" + month + \"/\" + year;\r\n this.setState({\r\n _wc_pre_orders_availability_datetime: formattedTime,\r\n });\r\n }\r\n });\r\n\r\n this.setState({\r\n loading: false,\r\n productImage : response.data[0].images[0].src,\r\n addons : response.data[0].addons,\r\n attributes : response.data[0].attributes,\r\n productId : response.data[0].id,\r\n productName : response.data[0].name,\r\n },() => this.getProductVariations(this.state.productId));\r\n })\r\n .catch((error) => {\r\n document.location.href = `/wps/portal/web/personal/store/error?errorSource=${\r\n window.lang === \"en\" ? \"Store\" : \"المتجر\"\r\n }`;\r\n\r\n this.openNotification(\r\n \"error\",\r\n error.response.data.data.status,\r\n error.response.data.message\r\n );\r\n this.setState({\r\n loading: false,\r\n });\r\n });\r\n };\r\n\r\n getProductVariations = (productId) => {\r\n this.setState({ loading: true });\r\n getProductVariationsById(productId)\r\n .then((response) => {\r\n if(response) {\r\n this.variations = response.data.filter((variation) => {\r\n return(variation.in_stock === true)\r\n });\r\n\r\n let enabledAttributes = [];\r\n let newFilters = [];\r\n this.state.attributes.map((attribute) => {\r\n //enabledAttributes.push({key : attribute.name, value : attribute.options});\r\n //newFilters.push({key : attribute.name, value : \"\"});\r\n enabledAttributes[attribute.name] = attribute.options;\r\n newFilters[attribute.name] = \"\";\r\n })\r\n\r\n this.setState ({\r\n stockAvailable : this.variations.length > 0,\r\n enabledAttributeOptions : enabledAttributes,\r\n filters : newFilters,\r\n loading: false,\r\n }, () => {\r\n //console.log('variations');\r\n //console.log(this.variations);\r\n //console.log('attributes');\r\n //console.log(this.state.attributes);\r\n //console.log('enabledAttributeOptions');\r\n //console.log(this.state.enabledAttributeOptions);\r\n //console.log('filters');\r\n //console.log(this.state.filters);\r\n \r\n //First call with no filter applied\r\n this.onFindVariation();\r\n })\r\n }\r\n })\r\n .catch((e) => {\r\n this.setState({\r\n loading: false,\r\n });\r\n });\r\n };\r\n\r\n onFilterPress = (event, key, value) => {\r\n //console.log(key+' > '+value);\r\n let newFilters = this.state.filters;\r\n \r\n if(key === 'Color' || key.includes('اللون')) {\r\n let imageUrl = this.getProductImageUrl(value);\r\n this.setState({\r\n productImage: imageUrl\r\n })\r\n }\r\n\r\n if(newFilters[key] === value) {\r\n newFilters[key] = \"\";\r\n } else {\r\n newFilters[key] = value;\r\n }\r\n\r\n this.setState({\r\n filters: newFilters\r\n }, () => {\r\n //Call with new set of filter applied\r\n //console.log(this.state.filters)\r\n this.onFindVariation();\r\n })\r\n }\r\n\r\n onFindVariation = () => {\r\n let filterCount = this.getChoosenAttributesCount();\r\n let price = \"\";\r\n let sku = \"\";\r\n let variationId = \"\";\r\n let cartIsDisabled = true;\r\n if(filterCount === this.state.attributes.length) {\r\n this.onUpdateAttributes();\r\n var matching_variations = this.findMatchingVariations(this.variations, this.state.filters);\r\n price = matching_variations[0].eshop_price;\r\n sku = matching_variations[0].sku;\r\n variationId = matching_variations[0].id;\r\n cartIsDisabled = false;\r\n console.log(matching_variations);\r\n } else {\r\n this.onUpdateAttributes();\r\n }\r\n this.setState({\r\n price: price,\r\n sku: sku,\r\n variationId: variationId,\r\n cartDisabled: cartIsDisabled,\r\n })\r\n }\r\n\r\n onUpdateAttributes = () => {\r\n \r\n let allAttributes = Object.assign({}, this.state.attributes);\r\n var enabledAttributes = [];\r\n \r\n this.state.attributes.forEach((attribute, index) => {\r\n\r\n let currentAttributes = Object.assign({}, this.state.filters);\r\n let current_attr_name = attribute.name;\r\n //let attached_options_count = 0;\r\n let new_attr_select = [];\r\n //let selected_attr_val = value;\r\n //let selected_attr_val_valid = true;\r\n\r\n for (const key in allAttributes) {\r\n if(allAttributes[key].name === current_attr_name) {\r\n new_attr_select[current_attr_name] = allAttributes[key].options.map((str,index) => ({value:str, id:index}));\r\n break;\r\n }\r\n }\r\n\r\n // The attribute of this select field should not be taken into account when calculating its matching variations:\r\n // The constraints of this attribute are shaped by the values of the other attributes.\r\n var checkAttributes = currentAttributes;\r\n checkAttributes[current_attr_name] = \"\";\r\n\r\n var variations = this.findMatchingVariations(this.variations, checkAttributes);\r\n // Loop through variations. \r\n\r\n for ( var num in variations ) {\r\n // if ( typeof( variations[ num ] ) !== 'undefined' ) {\r\n var variationAttributes = variations[ num ].attributes;\r\n\r\n for ( var attr in variationAttributes ) {\r\n //if ( variationAttributes.hasOwnProperty( attr_name ) ) {\r\n var attr_val = variationAttributes[ attr ].option;\r\n var attr_name = variationAttributes[attr].name;\r\n \r\n //let variation_active = '';\r\n if ( attr_name === current_attr_name ) {\r\n //if ( variations[ num ].variation_is_active ) {\r\n //variation_active = 'enabled';\r\n //}\r\n \r\n if ( attr_val ) {\r\n var option_elements = new_attr_select[current_attr_name];\r\n if ( option_elements.length ) {\r\n for (let i = 0, len = option_elements.length; i < len; i++) {\r\n var option_element = option_elements[i];\r\n var option_value = option_element.value;\r\n\r\n if ( attr_val === option_value ) {\r\n new_attr_select[current_attr_name][i].state = ( 'attached' )\r\n break;\r\n }\r\n }\r\n }\r\n } else {\r\n // Attach all if value is empty.\r\n let option_elements = new_attr_select[current_attr_name];\r\n if ( option_elements.length ) {\r\n for (let i = 0, len = option_elements.length; i < len; i++) {\r\n new_attr_select[current_attr_name][i].state = ( 'attached' )\r\n }\r\n }\r\n }\r\n }\r\n //}\r\n }\r\n // }\r\n }\r\n \r\n enabledAttributes[current_attr_name] = new_attr_select[current_attr_name].map((na) => { \r\n if(na.state && na.state.includes('attached')) {\r\n return na.value;\r\n }\r\n })\r\n //console.log(current_attr_name);\r\n //console.log(new_attr_select);\r\n });\r\n\r\n this.setState ({\r\n enabledAttributeOptions : enabledAttributes,\r\n })\r\n \r\n }\r\n \r\n findMatchingVariations = (variations, attributes) => {\r\n var matching = [];\r\n for ( var i = 0; i < variations.length; i++ ) {\r\n var variation = variations[i];\r\n\r\n if(this.isMatch( variation.attributes, attributes )) {\r\n matching.push( variation );\r\n }\r\n }\r\n return matching;\r\n }\r\n\r\n isMatch = (variation_attributes, attributes) => {\r\n var match = true;\r\n for ( var attr_name in variation_attributes ) {\r\n var attribute = variation_attributes[ attr_name ];\r\n var val1 = attribute.option;\r\n var val2 = attributes[ attribute.name ];\r\n if ( val1 !== undefined && val2 !== undefined && val1.length !== 0 && val2.length !== 0 && val1 !== val2 ) {\r\n match = false;\r\n }\r\n }\r\n return match;\r\n }\r\n\r\n getChoosenAttributesCount = () => {\r\n let filters = this.state.filters;\r\n let filterCount = 0;\r\n if(filters) {\r\n for (let key in filters) {\r\n if(filters[key] !== \"\")\r\n filterCount++\r\n }\r\n }\r\n return filterCount;\r\n }\r\n\r\n openNotification = (type, code, desc) => {\r\n notification[type]({\r\n message: \"Error: \" + code,\r\n description: desc,\r\n });\r\n };\r\n\r\n\r\n addItemsToCart = (redirect) => {\r\n this.setState({\r\n loading: true,\r\n });\r\n let cart_key = \"\";\r\n if (this.props.cart.length === 0) {\r\n cart_key = uuidv4();\r\n } else {\r\n cart_key = this.props.cart[0].cart_key;\r\n }\r\n let addOn = \"\";\r\n let field_name = \"\";\r\n if (this.state.addons[0]) {\r\n addOn = this.state.selectedOption;\r\n field_name = this.state.addons[0].field_name;\r\n }\r\n\r\n addItemsToCart(\r\n cart_key,\r\n this.state.productId,\r\n this.state.counter,\r\n this.state.variationId,\r\n addOn,\r\n field_name\r\n )\r\n .then((response) => {\r\n this.setState({\r\n loading: false,\r\n });\r\n if (response.status !== 200 && response.status !== 201) {\r\n if (\r\n response.response.data.code ===\r\n \"cocart_add_item_pre_order_cannot_add\"\r\n ) {\r\n window.sessionStorage.sku = \"\";\r\n window.sessionStorage.po_error_msg = response.response.data.message;\r\n window.location.href = window.storeCartURL;\r\n }\r\n this.openNotification(\"error\", response.status, response.statusText);\r\n this.setState({ cart_key: cart_key });\r\n return;\r\n }\r\n this.setState({\r\n cart_key: cart_key,\r\n });\r\n window.localStorage.cartKey = cart_key;\r\n this.props.addToCart({\r\n id: this.state.productId,\r\n name: this.state.productName,\r\n image:this.state.productImage,\r\n //capacity: this.state.fields[\"3\"],\r\n //color: this.state.fields[\"4\"],\r\n quantity: this.state.counter,\r\n variation_id: this.state.variationId,\r\n price: this.state.counter * this.state.price,\r\n stock_quantity: this.state.stock_quantity,\r\n cart_key: cart_key,\r\n product_type: \"phone\",\r\n cart_item_key: response.data.key,\r\n });\r\n if (redirect) {\r\n window.sessionStorage.sku = \"\";\r\n window.sessionStorage.celebrusSku = this.state\r\n window.location.href = window.storeCartURL;\r\n }\r\n })\r\n .catch((error) => {\r\n this.openNotification(\r\n \"error\",\r\n error.response.data.data.status,\r\n error.response.data.message\r\n );\r\n this.setState({\r\n loading: false,\r\n });\r\n });\r\n };\r\n\r\n doShoppingCartAction = () => {\r\n const { offer_id } = this.state;\r\n if (offer_id) {\r\n this.goToOffer();\r\n return;\r\n }\r\n window.scrollTo({\r\n top: 0,\r\n behavior: \"smooth\",\r\n });\r\n\r\n /*\r\n let filteredCart = this.props.cart.filter(\r\n (item) =>\r\n item.id === this.state.productId &&\r\n item.variation_id === this.state.variationId\r\n );\r\n */\r\n //TODO : check cart item exist disabled\r\n // if (filteredCart.length === 0) {\r\n this.addItemsToCart(true);\r\n // } else {\r\n // this.updateItem(this.state.counter, filteredCart[0], true);\r\n // }\r\n };\r\n\r\n updateItem = (quantity, item, redirect) => {\r\n this.setState({\r\n loading: true,\r\n });\r\n updateItem(quantity, item.cart_key, item.cart_item_key)\r\n .then((response) => {\r\n if (response.status !== 200 && response.status !== 201) {\r\n this.openNotification(\"error\", response.status, response.statusText);\r\n this.setState({\r\n loading: false,\r\n });\r\n }\r\n\r\n // this.getCartTotal();\r\n item.quantity = quantity;\r\n this.props.updateProductItem(item);\r\n if (redirect) {\r\n window.location.href = window.storeCartURL;\r\n }\r\n })\r\n .catch((error) => {\r\n this.openNotification(\r\n \"error\",\r\n \"error\" + error.response.data.data.status,\r\n error.response.data.message\r\n );\r\n this.setState({\r\n loading: false,\r\n });\r\n });\r\n };\r\n\r\n goToOffer = () => {\r\n window.sessionStorage.offer_id = this.state.offer_id;\r\n window.sessionStorage.product_id = this.state.productId;\r\n window.sessionStorage.variation_id = this.state.variationId;\r\n\r\n window.location.href = window.storeOffersURL;\r\n };\r\n\r\n onChange = (e) => {\r\n this.setState({\r\n appleCarePrice: e.target.value? parseFloat(e.target.value.price) : 0,\r\n selectedOption: e.target.value,\r\n });\r\n };\r\n\r\n getProductImageUrl = (color) => {\r\n let imageUrl = '';\r\n for(let i = 0; i {\r\n const { t } = this.props;\r\n const { selectedOption, appleCarePrice, price } = this.state;\r\n let allAttributes = this.state.attributes;\r\n let totalPrice = (price? parseFloat(price) : 0) + appleCarePrice;\r\n\r\n return (\r\n
\r\n {!this.state.stockAvailable ? (\r\n \r\n {t(\"out_of_stock\")}\r\n
\r\n ) : null}\r\n\r\n \r\n \r\n {this.state._wc_pre_orders_enabled && (\r\n \r\n \r\n {t(\"availability_date\")}\r\n

\r\n \r\n {this.state._wc_pre_orders_availability_datetime}\r\n

\r\n \r\n )}\r\n \r\n {\r\n allAttributes.map((attribute) => {\r\n return(\r\n \r\n )\r\n })\r\n }\r\n\r\n {!!this.state.addons && !!this.state.addons.length ? (\r\n
\r\n \r\n {this.state.addons[0].name}\r\n

\r\n \r\n

\r\n \r\n

\r\n \r\n
\r\n\r\n \r\n \r\n \r\n {t(\"none\")}\r\n \r\n {this.state.addons[0].options.map((item, i) => {\r\n return (\r\n \r\n {`${item.label} (+${item.price} ${t(\"SAR\")})`}\r\n \r\n );\r\n })}\r\n \r\n \r\n
\r\n
\r\n ) : null}\r\n \r\n
\r\n

\r\n {t(\"raqi_title\")}\r\n

\r\n \r\n

{t(\"discount_text\")}

\r\n

{t(\"discount_text1\")}

\r\n \r\n {\r\n this.setState({ offer_id: value });\r\n }}\r\n >\r\n {offers.map((item, i) => (\r\n \r\n ))}\r\n \r\n
\r\n \r\n
\r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n
\r\n }\r\n disabled={this.state.cartDisabled}\r\n onClick={() => this.doShoppingCartAction()}\r\n >\r\n
\r\n \r\n \r\n {/*
{window.sessionStorage.sku}
*/}\r\n
{this.state.sku === \"\" ? window.sessionStorage.sku : this.state.sku}
\r\n
{this.state.variationId}
\r\n
{this.state.productId}
\r\n\r\n
pageProductView
\r\n {/*
pageProductView
*/}\r\n
\r\n \r\n );\r\n };\r\n\r\n render() {\r\n return (\r\n
\r\n
\r\n {this.state.productName}/\r\n
\r\n {this.renderProductDetails()}\r\n
\r\n );\r\n }\r\n}\r\n\r\nconst mapDispatchToProps = (dispatch) => {\r\n return {\r\n updateProductItem(product) {\r\n dispatch(updateProductItem(product));\r\n },\r\n addToCart(product) {\r\n dispatch(addToCart(product));\r\n },\r\n };\r\n};\r\n\r\nconst mapStateToProps = (state) => {\r\n return {\r\n cart: state.cart,\r\n };\r\n};\r\n\r\nexport default withTranslation()(\r\n connect(mapStateToProps, mapDispatchToProps)(ProductDetails)\r\n);\r\n","const addToCart = (product) => {\r\n //Save just the important\r\n // console.log(\"id \"+ product.id)\r\n // console.log(\"name \"+ product.name)\r\n // console.log(\"color \"+ product.color)\r\n\r\n // console.log(\"quantity \"+ product.quantity)\r\n // console.log(\"variation_id \"+ product.variation_id)\r\n // console.log(\"eshop_price \"+ product.eshop_price)\r\n // console.log(\"stock_quantity \"+ product.stock_quantity)\r\n // console.log(\"cart_key \"+ product.cart_key)\r\n // console.log(\"product_type \"+ product.product_type)\r\n\r\n var p = {};\r\n\r\n p.id = product.id;\r\n p.product_name = product.name;\r\n p.color = product.color;\r\n p.image = product.image;\r\n p.capacity = product.capacity;\r\n p.quantity = product.quantity;\r\n p.variation_id = product.variation_id;\r\n p.line_total = product.eshop_price;\r\n p.stock_quantity = product.stock_quantity;\r\n p.cart_key = product.cart_key;\r\n p.product_type = product.product_type;\r\n p.cart_item_key = product.cart_item_key;\r\n\r\n return {\r\n type: \"ADD_TO_CART\",\r\n product: p,\r\n };\r\n};\r\n\r\nconst removeFromCart = (product) => {\r\n return {\r\n type: \"REMOVE_FROM_CART\",\r\n product,\r\n };\r\n};\r\n\r\nconst updateProductItem = (product) => {\r\n return {\r\n //DECREASE PRODUCT CART\r\n type: \"UPDATE_PRODUCT_ITEM\",\r\n product,\r\n };\r\n};\r\n\r\nconst substractProduct = (product) => {\r\n return {\r\n type: \"SUBSTRACT_FROM_CART\",\r\n product,\r\n };\r\n};\r\n\r\nconst loadCartProducts = () => {\r\n return {\r\n type: \"LOAD_CART_PRODUCTS\",\r\n };\r\n};\r\n\r\nexport {\r\n addToCart,\r\n removeFromCart,\r\n substractProduct,\r\n loadCartProducts,\r\n updateProductItem,\r\n};\r\n","import i18n from \"i18next\";\r\nimport { initReactI18next } from \"react-i18next\";\r\nimport XHR from \"i18next-xhr-backend\";\r\n\r\nconst allowedLanguages = [\"en\", \"ar\"];\r\n// window.lang=\"ar\"\r\nlet lng = window.lang;\r\n\r\nconst storageLanguage = localStorage.getItem(\"language\");\r\nif (storageLanguage && allowedLanguages.indexOf(storageLanguage) > -1) {\r\n lng = window.lang;\r\n}\r\n\r\ni18n\r\n .use(XHR)\r\n .use(initReactI18next)\r\n .init({\r\n lng,\r\n debug: false,\r\n keySeparator: false,\r\n interpolation: {\r\n escapeValue: false,\r\n },\r\n fallbackLng: \"en\",\r\n backend: {\r\n loadPath: \"/.store.devices.ui/react-app/build/translations/{{lng}}.json\",\r\n // loadPath: '/translations/{{lng}}.json',\r\n allowMultiLoading: true,\r\n },\r\n react: {\r\n wait: true,\r\n useSuspense: true,\r\n },\r\n });\r\n\r\nexport default i18n;\r\n","import React, { Component, Fragment } from \"react\";\r\nimport ProductDetails from \"./components/ProductDetails\";\r\nimport \"./i18n\";\r\n\r\nconst errorPage = window.errorPageURL;\r\n\r\nfunction isEmpty(val) {\r\n if (val === undefined) return true;\r\n\r\n if (\r\n typeof val == \"function\" ||\r\n typeof val == \"number\" ||\r\n typeof val == \"boolean\" ||\r\n Object.prototype.toString.call(val) === \"[object Date]\"\r\n )\r\n return false;\r\n\r\n if (val == null || val.length === 0)\r\n // null or 0 length array\r\n return true;\r\n\r\n if (typeof val == \"object\") {\r\n // empty object\r\n\r\n var r = true;\r\n\r\n for (var f in val) r = false;\r\n\r\n return r;\r\n }\r\n\r\n return false;\r\n}\r\n\r\nclass App extends Component {\r\n getParameter(sku) {\r\n const search = window.location.search;\r\n const params = new URLSearchParams(search);\r\n\r\n return params.get(sku);\r\n }\r\n\r\n componentDidMount() {\r\n document.title = \"Mobily - Shop - Devices & Accessories\";\r\n }\r\n render() {\r\n let sku = window.sessionStorage.sku;\r\n\r\n if (isEmpty(sku)) {\r\n sku = this.getParameter(\"sku\");\r\n }\r\n console.log(\"sku\", sku);\r\n if (!sku) {\r\n document.location.href = errorPage;\r\n }\r\n //const productId = '506905'\r\n return (\r\n //\r\n \r\n );\r\n }\r\n}\r\n\r\nexport default App;\r\n","// This optional code is used to register a service worker.\r\n// register() is not called by default.\r\n\r\n// This lets the app load faster on subsequent visits in production, and gives\r\n// it offline capabilities. However, it also means that developers (and users)\r\n// will only see deployed updates on subsequent visits to a page, after all the\r\n// existing tabs open on the page have been closed, since previously cached\r\n// resources are updated in the background.\r\n\r\n// To learn more about the benefits of this model and instructions on how to\r\n// opt-in, read http://bit.ly/CRA-PWA\r\n\r\nconst isLocalhost = Boolean(\r\n window.location.hostname === \"localhost\" ||\r\n // [::1] is the IPv6 localhost address.\r\n window.location.hostname === \"[::1]\" ||\r\n // 127.0.0.1/8 is considered localhost for IPv4.\r\n window.location.hostname.match(\r\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\r\n )\r\n);\r\n\r\nexport function register(config) {\r\n if (process.env.NODE_ENV === \"production\" && \"serviceWorker\" in navigator) {\r\n // The URL constructor is available in all browsers that support SW.\r\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\r\n if (publicUrl.origin !== window.location.origin) {\r\n // Our service worker won't work if PUBLIC_URL is on a different origin\r\n // from what our page is served on. This might happen if a CDN is used to\r\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\r\n return;\r\n }\r\n\r\n window.addEventListener(\"load\", () => {\r\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\r\n\r\n if (isLocalhost) {\r\n // This is running on localhost. Let's check if a service worker still exists or not.\r\n checkValidServiceWorker(swUrl, config);\r\n\r\n // Add some additional logging to localhost, pointing developers to the\r\n // service worker/PWA documentation.\r\n navigator.serviceWorker.ready.then(() => {\r\n console.log(\r\n \"This web app is being served cache-first by a service \" +\r\n \"worker. To learn more, visit http://bit.ly/CRA-PWA\"\r\n );\r\n });\r\n } else {\r\n // Is not localhost. Just register service worker\r\n registerValidSW(swUrl, config);\r\n }\r\n });\r\n }\r\n}\r\n\r\nfunction registerValidSW(swUrl, config) {\r\n navigator.serviceWorker\r\n .register(swUrl)\r\n .then((registration) => {\r\n registration.onupdatefound = () => {\r\n const installingWorker = registration.installing;\r\n if (installingWorker == null) {\r\n return;\r\n }\r\n installingWorker.onstatechange = () => {\r\n if (installingWorker.state === \"installed\") {\r\n if (navigator.serviceWorker.controller) {\r\n // At this point, the updated precached content has been fetched,\r\n // but the previous service worker will still serve the older\r\n // content until all client tabs are closed.\r\n console.log(\r\n \"New content is available and will be used when all \" +\r\n \"tabs for this page are closed. See http://bit.ly/CRA-PWA.\"\r\n );\r\n\r\n // Execute callback\r\n if (config && config.onUpdate) {\r\n config.onUpdate(registration);\r\n }\r\n } else {\r\n // At this point, everything has been precached.\r\n // It's the perfect time to display a\r\n // \"Content is cached for offline use.\" message.\r\n console.log(\"Content is cached for offline use.\");\r\n\r\n // Execute callback\r\n if (config && config.onSuccess) {\r\n config.onSuccess(registration);\r\n }\r\n }\r\n }\r\n };\r\n };\r\n })\r\n .catch((error) => {\r\n console.error(\"Error during service worker registration:\", error);\r\n });\r\n}\r\n\r\nfunction checkValidServiceWorker(swUrl, config) {\r\n // Check if the service worker can be found. If it can't reload the page.\r\n fetch(swUrl)\r\n .then((response) => {\r\n // Ensure service worker exists, and that we really are getting a JS file.\r\n const contentType = response.headers.get(\"content-type\");\r\n if (\r\n response.status === 404 ||\r\n (contentType != null && contentType.indexOf(\"javascript\") === -1)\r\n ) {\r\n // No service worker found. Probably a different app. Reload the page.\r\n navigator.serviceWorker.ready.then((registration) => {\r\n registration.unregister().then(() => {\r\n window.location.reload();\r\n });\r\n });\r\n } else {\r\n // Service worker found. Proceed as normal.\r\n registerValidSW(swUrl, config);\r\n }\r\n })\r\n .catch(() => {\r\n console.log(\r\n \"No internet connection found. App is running in offline mode.\"\r\n );\r\n });\r\n}\r\n\r\nexport function unregister() {\r\n if (\"serviceWorker\" in navigator) {\r\n navigator.serviceWorker.ready.then((registration) => {\r\n registration.unregister();\r\n });\r\n }\r\n}\r\n","/**\r\n * Cart function\r\n * @param state\r\n * @param action\r\n * @returns {*}\r\n */\r\n const cart = (state = [], action) => {\r\n if (action.type === \"LOAD_CART_PRODUCTS\") {\r\n try {\r\n return JSON.parse(localStorage.getItem(\"cart\")) || [];\r\n } catch (e) {\r\n localStorage.setItem(\"cart\", JSON.stringify([]));\r\n return [];\r\n }\r\n } else if (action.type === \"ADD_TO_CART\") {\r\n const { product } = action;\r\n let exists = false;\r\n console.log(\"product \" + JSON.stringify(product));\r\n const changed = state.map((e) => {\r\n if (e.id === product.id && e.variation_id === product.variation_id) {\r\n exists = true;\r\n e.quantity = product.quantity;\r\n }\r\n return e;\r\n });\r\n if (!exists) {\r\n return state.concat(product);\r\n }\r\n return changed;\r\n } else if (action.type === \"REMOVE_FROM_CART\") {\r\n return state.filter((e) => {\r\n console.log(\"REMOVE_FROM_CART\"+JSON.stringify(e))\r\n return e.id !== action.product.id;\r\n });\r\n } else if (action.type === \"UPDATE_PRODUCT_ITEM\") {\r\n return state.map((e) => {\r\n console.log(\"UPDATE_PRODUCT_ITEM\"+JSON.stringify(e))\r\n console.log(\"UPDATE_PRODUCT_ITEM\"+JSON.stringify(action.product))\r\n if (\r\n e.id === action.product.id &&\r\n e.variation_id === action.product.variation_id\r\n ) {\r\n e.quantity = action.product.quantity;\r\n }\r\n return e;\r\n });\r\n }\r\n return state;\r\n };\r\n \r\nexport default cart;","import { createStore, applyMiddleware, combineReducers } from \"redux\";\r\nimport thunk from \"redux-thunk\";\r\nimport cart from './reducers/cart';\r\n\r\n/**\r\n * Logger middleware\r\n * @param store\r\n * @returns {function(*): function(*=): *}\r\n */\r\nconst logger = (store) => (next) => (action) => {\r\n // console.log(\"dispatching\", action);\r\n let result = next(action);\r\n // console.log(\"next state\", store.getState());\r\n return result;\r\n};\r\n\r\nconst updateLocalStorageCart = (store) => (next) => (action) => {\r\n let result = next(action);\r\n\r\n if (\r\n action.type === \"ADD_TO_CART\" ||\r\n action.type === \"REMOVE_FROM_CART\" ||\r\n action.type === \"UPDATE_PRODUCT_ITEM\"\r\n ) {\r\n try {\r\n localStorage.setItem(\"cart\", JSON.stringify(store.getState()[\"cart\"]));\r\n } catch (e) {\r\n console.log(\"Error trying to set cart\", e);\r\n localStorage.setItem(\"cart\", JSON.stringify([]));\r\n }\r\n }\r\n return result;\r\n};\r\n\r\nconst store = createStore(\r\n combineReducers({\r\n cart,\r\n }),\r\n applyMiddleware(logger, thunk, updateLocalStorageCart)\r\n);\r\n\r\nexport default store;","import \"react-app-polyfill/ie11\";\r\nimport \"react-app-polyfill/stable\";\r\nimport React, { Suspense } from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport App from \"./App\";\r\nimport \"antd/dist/antd.css\"; // or 'antd/dist/antd.less'\r\n// import \"bootstrap/dist/css/bootstrap.min.css\";\r\n\r\nimport \"./App.css\";\r\n\r\nimport * as serviceWorker from \"./serviceWorker\";\r\nimport \"./i18n\";\r\nimport { ConfigProvider } from \"antd\";\r\n// import ar_EG from 'antd/es/locale/ar_EG';\r\nimport store from \"./store\";\r\nimport { Provider } from \"react-redux\";\r\nimport { loadCartProducts } from \"./actions/actions\";\r\n\r\nstore.dispatch(loadCartProducts());\r\n\r\nReactDOM.render(\r\n \r\n }>\r\n \r\n \r\n \r\n \r\n ,\r\n document.getElementById(\"root\")\r\n);\r\n\r\n// If you want your app to work offline and load faster, you can change\r\n// unregister() to register() below. Note this comes with some pitfalls.\r\n// Learn more about service workers: http://bit.ly/CRA-PWA\r\nserviceWorker.unregister();\r\n"],"sourceRoot":""}