whoami7 - Manager
:
/
home
/
dataiclx
/
vielorbe.com
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
surecart
/
Upload File:
files >> //home/dataiclx/vielorbe.com/wp-content/plugins/surecart/dist/components/surecart/p-9dbc54d6.js.map
{"version":3,"names":["isObject","item","Array","isArray","getSerializedState","storeTag","document","querySelector","state","JSON","parse","textContent","Error","e","console","error","isProductVariantOptionSoldOut","optionNumber","option","variantValues","product","stock_enabled","allow_out_of_stock_purchases","items","_c","_b","_a","variants","data","filter","call","variant","option_1","highestStock","Math","max","map","available_stock","_d","option_2","_e","option_3","isProductVariantOptionMissing","some"],"sources":["src/store/utils.ts"],"sourcesContent":["import { Product } from '../types';\n\nconst isObject = item => item && typeof item === 'object' && !Array.isArray(item);\n\nexport const getSerializedState = () => {\n const storeTag = document.querySelector(`script[type=\"application/json\"]#sc-store-data`);\n if (!storeTag) return {};\n try {\n const state = JSON.parse(storeTag.textContent);\n if (isObject(state)) return state;\n throw Error('Parsed state is not an object');\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(e);\n }\n return {};\n};\n\n/**\n * Is this variant option sold out.\n */\nexport const isProductVariantOptionSoldOut = (optionNumber, option, variantValues, product: Product) => {\n // product stock is not enabled or out of stock purchases are allowed.\n if (!product?.stock_enabled || product?.allow_out_of_stock_purchases) return false;\n\n // if this is option 1, check to see if there are any variants with this option.\n if (optionNumber === 1) {\n const items = (product.variants?.data || []).filter?.(variant => variant.option_1 === option);\n const highestStock = Math.max(...items.map(item => item.available_stock));\n return highestStock <= 0;\n }\n\n // if this is option 2, check to see if there are any variants with this option and option 1\n if (optionNumber === 2) {\n const items = (product.variants?.data || []).filter(variant => variant?.option_1 === variantValues.option_1 && variant.option_2 === option);\n const highestStock = Math.max(...items.map(item => item.available_stock));\n return highestStock <= 0;\n }\n\n // if this is option 4, check to see if there are any variants with all the options.\n const items = (product.variants?.data || []).filter(\n variant => variant?.option_1 === variantValues.option_1 && variant?.option_2 === variantValues.option_2 && variant.option_3 === option,\n );\n const highestStock = Math.max(...items.map(item => item.available_stock));\n return highestStock <= 0;\n};\n\n/**\n * Is this variant option missing/unavailable?\n */\nexport const isProductVariantOptionMissing = (optionNumber: number, option: string, variantValues, product: Product) => {\n // if this is option 1, check to see if there are any variants with this option.\n if (optionNumber === 1) {\n return !(product?.variants?.data || []).some(variant => variant.option_1 === option);\n }\n\n // if this is option 2, check to see if there are any variants with this option and option 1\n if (optionNumber === 2) {\n return !(product?.variants?.data || []).some(variant => variant?.option_1 === variantValues.option_1 && variant.option_2 === option);\n }\n\n // if this is option 3, check to see if there are any variants with all the options.\n return !(product?.variants?.data || []).some(\n variant => variant?.option_1 === variantValues.option_1 && variant?.option_2 === variantValues.option_2 && variant.option_3 === option,\n );\n};\n"],"mappings":"AAEA,MAAMA,EAAWC,GAAQA,UAAeA,IAAS,WAAaC,MAAMC,QAAQF,G,MAE/DG,EAAqB,KAChC,MAAMC,EAAWC,SAASC,cAAc,iDACxC,IAAKF,EAAU,MAAO,GACtB,IACE,MAAMG,EAAQC,KAAKC,MAAML,EAASM,aAClC,GAAIX,EAASQ,GAAQ,OAAOA,EAC5B,MAAMI,MAAM,gC,CACZ,MAAOC,GAEPC,QAAQC,MAAMF,E,CAEhB,MAAO,EAAE,E,MAMEG,EAAgC,CAACC,EAAcC,EAAQC,EAAeC,K,cAEjF,KAAKA,IAAO,MAAPA,SAAO,SAAPA,EAASC,iBAAiBD,IAAO,MAAPA,SAAO,SAAPA,EAASE,8BAA8B,OAAO,MAG7E,GAAIL,IAAiB,EAAG,CACtB,MAAMM,GAAQC,GAAAC,IAACC,EAAAN,EAAQO,YAAQ,MAAAD,SAAA,SAAAA,EAAEE,OAAQ,IAAIC,UAAM,MAAAL,SAAA,SAAAA,EAAAM,KAAAL,GAAGM,GAAWA,EAAQC,WAAad,IACtF,MAAMe,EAAeC,KAAKC,OAAOZ,EAAMa,KAAInC,GAAQA,EAAKoC,mBACxD,OAAOJ,GAAgB,C,CAIzB,GAAIhB,IAA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