From edf17e926f3d186e7630da2834d78de3e540a956 Mon Sep 17 00:00:00 2001 From: malbert69 Date: Fri, 18 Sep 2020 19:09:47 -0500 Subject: [PATCH] feat(store): microcenter (#39) Co-authored-by: Ion Caza Co-authored-by: Jef LeCompte --- .gitignore | 2 ++ README.md | 1 + src/store/index.ts | 30 ++++++++------------------- src/store/microcenter.ts | 44 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 22 deletions(-) create mode 100644 src/store/microcenter.ts diff --git a/.gitignore b/.gitignore index 7b8b2d5..60de4b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .idea/ +.vs/ +.vscode/ build/ node_modules/ diff --git a/README.md b/README.md index bc120bc..f72d634 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ First, you're going to need to copy the `.env.example` to `.env`. The current op | Amazon | `amazon`| | B&H | `bandh`| | EVGA | `evga`| +| Micro Center | `microcenter`| | Newegg | `newegg`| | Nvidia | `nvidia`| diff --git a/src/store/index.ts b/src/store/index.ts index 1a60f5c..0a29abf 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -4,39 +4,25 @@ import {Evga} from './evga'; import {NewEgg} from './newegg'; import {Nvidia} from './nvidia'; import {Amazon} from './amazon'; +import {MicroCenter} from './microcenter'; import {Config} from '../config'; -const list = new Map([ +const masterList = new Map([ + ['amazon', Amazon], ['bestbuy', BestBuy], ['bandh', BAndH], ['evga', Evga], - ['amazon', Amazon], + ['microcenter', MicroCenter], ['newegg', NewEgg], ['nvidia', Nvidia] ]); -if (!Config.stores.toLowerCase().includes('bestbuy')) { - list.delete('bestbuy'); -} +const list = new Map(); -if (!Config.stores.toLowerCase().includes('bandh')) { - list.delete('bandh'); -} +const storeArray = Config.stores.split(','); -if (!Config.stores.toLowerCase().includes('evga')) { - list.delete('evga'); -} - -if (!Config.stores.toLowerCase().includes('amazon')) { - list.delete('amazon'); -} - -if (!Config.stores.toLowerCase().includes('newegg')) { - list.delete('newegg'); -} - -if (!Config.stores.toLowerCase().includes('nvidia')) { - list.delete('nvidia'); +for (const name of storeArray) { + list.set(name, masterList.get(name)); } export const Stores = Array.from(list.values()); diff --git a/src/store/microcenter.ts b/src/store/microcenter.ts new file mode 100644 index 0000000..2391baa --- /dev/null +++ b/src/store/microcenter.ts @@ -0,0 +1,44 @@ +import {Store} from './store'; + +export const MicroCenter: Store = { + cartUrl: '', + links: [ + { + brand: 'evga', + model: 'xc3 ultra gaming', + url: 'https://www.microcenter.com/product/628344/evga-geforce-rtx-3080-xc3-ultra-gaming-triple-fan-10gb-gddr6x-pcie-40-graphics-card', + oosLabels: ['sold out'] + }, + { + brand: 'msi', + model: 'ventus 3x overclocked', + url: 'https://www.microcenter.com/product/628331/msi-geforce-rtx-3080-ventus-3x-overclocked-triple-fan-10gb-gddr6x-pcie-40-graphics-card', + oosLabels: ['sold out'] + }, + { + brand: 'asus', + model: 'tuf gaming', + url: 'https://www.microcenter.com/product/628303/asus-geforce-rtx-3080-tuf-gaming-triple-fan-10gb-gddr6x-pcie-40-graphics-card', + oosLabels: ['sold out'] + }, + { + brand: 'msi', + model: 'gaming x trio', + url: 'https://www.microcenter.com/product/628330/msi-geforce-rtx-3080-gaming-x-trio-triple-fan-10gb-gddr6x-pcie-40-graphics-card', + oosLabels: ['sold out'] + }, + { + brand: 'evga', + model: 'xc3 black', + url: 'https://www.microcenter.com/product/628340/evga-geforce-rtx-3080-xc3-black-triple-fan-10gb-gddr6x-pcie-40-graphics-card', + oosLabels: ['sold out'] + }, + { + brand: 'zotac', + model: 'trinity overclocked', + url: 'https://www.microcenter.com/product/628607/zotac-geforce-rtx-3080-trinity-overclocked-triple-fan-10gb-gddr6x-pcie-40-graphics-card', + oosLabels: ['sold out'] + } + ], + name: 'microcenter' +};