whoami7 - Manager
:
/
home
/
dataiclx
/
vielorbe.com
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
cjs
/
Upload File:
files >> //home/dataiclx/vielorbe.com/wp-content/plugins/surecart/dist/components/cjs/utils-2e91d46c.js.map
{"file":"utils-2e91d46c.js","mappings":";;AAEA,MAAM,QAAQ,GAAG,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;MAErE,kBAAkB,GAAG;IAChC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,+CAA+C,CAAC,CAAC;IACzF,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,IAAI;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC/C,IAAI,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAClC,MAAM,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAC9C;IAAC,OAAO,CAAC,EAAE;;QAEV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAClB;IACD,OAAO,EAAE,CAAC;AACZ,EAAE;AAEF;;;MAGa,6BAA6B,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,OAAgB;;;IAEjG,IAAI,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,CAAA,KAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,4BAA4B,CAAA;QAAE,OAAO,KAAK,CAAC;;IAGnF,IAAI,YAAY,KAAK,CAAC,EAAE;QACtB,MAAM,KAAK,GAAG,MAAA,OAAC,CAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,IAAI,KAAI,EAAE,CAAC,EAAC,MAAM,mDAAG,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC;QAC9F,MAAM,Y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B,OAAO,CAAC,CAAC,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,0CAAE,IAAI,KAAI,EAAE,EAAE,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC;KACtF;;IAGD,IAAI,YAAY,KAAK,CAAC,EAAE;QACtB,OAAO,CAAC,CAAC,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,0CAAE,IAAI,KAAI,EAAE,EAAE,IAAI,CAAC,OAAO,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,MAAK,aAAa,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC;KACtI;;IAGD,OAAO,CAAC,CAAC,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,0CAAE,IAAI,KAAI,EAAE,EAAE,IAAI,CAC1C,OAAO,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,MAAK,aAAa,CAAC,QAAQ,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,MAAK,aAAa,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,KAAK,MAAM,CACvI,CAAC;AACJ;;;;;;","names":[],"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"],"version":3}
Copyright ©2021 || Defacer Indonesia