From d56bcddb05a57f0fe30629c4fd0b56345e2c5b91 Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Tue, 8 Dec 2020 13:49:30 -0500 Subject: [PATCH] chore(store): add xbox to bestbuy-ca and amazon-ca Resolves #982 --- src/store/lookup.ts | 18 +++++++++--------- src/store/model/amazon-ca.ts | 16 ++++++++++++++++ src/store/model/bestbuy-ca.ts | 25 +++++++++++++++++++------ src/store/model/bestbuy.ts | 3 +-- 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/src/store/lookup.ts b/src/store/lookup.ts index 61ade0d257..211399adf2 100644 --- a/src/store/lookup.ts +++ b/src/store/lookup.ts @@ -347,6 +347,15 @@ async function lookupCardInStock(store: Store, page: Page, link: Link) { // return store.realTimeInventoryLookup(link.itemNumber); // } + if (store.labels.outOfStock) { + if ( + await pageIncludesLabels(page, store.labels.outOfStock, baseOptions) + ) { + logger.info(Print.outOfStock(link, store, true)); + return false; + } + } + if (store.labels.inStock) { const options = { ...baseOptions, @@ -373,15 +382,6 @@ async function lookupCardInStock(store: Store, page: Page, link: Link) { } } - if (store.labels.outOfStock) { - if ( - await pageIncludesLabels(page, store.labels.outOfStock, baseOptions) - ) { - logger.info(Print.outOfStock(link, store, true)); - return false; - } - } - return true; } diff --git a/src/store/model/amazon-ca.ts b/src/store/model/amazon-ca.ts index 680130083b..d224e78264 100644 --- a/src/store/model/amazon-ca.ts +++ b/src/store/model/amazon-ca.ts @@ -214,6 +214,22 @@ export const AmazonCa: Store = { model: 'ps5 digital', series: 'sonyps5de', url: 'https://www.amazon.ca/dp/B08GS1N24H' + }, + { + brand: 'microsoft', + cartUrl: + 'https://www.amazon.ca/gp/aws/cart/add.html?ASIN.1=B08H75RTZ8&Quantity.1=1', + model: 'xbox series x', + series: 'xboxsx', + url: 'https://www.amazon.ca/dp/B08H75RTZ8' + }, + { + brand: 'microsoft', + cartUrl: + 'https://www.amazon.ca/gp/aws/cart/add.html?ASIN.1=B08G9J44ZN&Quantity.1=1', + model: 'xbox series s', + series: 'xboxss', + url: 'https://www.amazon.ca/dp/B08G9J44ZN' } ], name: 'amazon-ca' diff --git a/src/store/model/bestbuy-ca.ts b/src/store/model/bestbuy-ca.ts index 00f1d3c83b..db355ac64b 100644 --- a/src/store/model/bestbuy-ca.ts +++ b/src/store/model/bestbuy-ca.ts @@ -3,17 +3,16 @@ import {Store} from './store'; export const BestBuyCa: Store = { labels: { inStock: { - container: '.x-checkout-experience-new', + container: '.addToCartContainer_2uzan', text: ['add to cart'] }, maxPrice: { - container: - 'div[class^="productPricingContainer"] span[class^="screenReaderOnly_"', + container: '.pricingContainer_25k3c', euroFormat: false }, outOfStock: { - container: 'button.addToCartButton.disabled_XY3i_', - text: ['Add to Cart'] + container: '.shippingAvailability_2RMa1', + text: ['coming soon'] } }, links: [ @@ -22,7 +21,7 @@ export const BestBuyCa: Store = { model: 'test:model', series: 'test:series', url: - 'https://www.bestbuy.ca/en-ca/product/evga-geforce-gtx-1660-xc-ultra-6gb-gddr5-video-card/14119081?intl=nosplash' + 'https://www.bestbuy.ca/en-ca/product/zotac-nvidia-geforce-gtx-1660-super-twin-fan-6gb-gddr6-video-card/14415897' }, { brand: 'msi', @@ -163,6 +162,20 @@ export const BestBuyCa: Store = { series: 'sonyps5de', url: 'https://www.bestbuy.ca/en-ca/product/playstation-5-digital-edition-console-online-only/14962184?intl=nosplash' + }, + { + brand: 'microsoft', + model: 'xbox series x', + series: 'xboxsx', + url: + 'https://www.bestbuy.ca/en-ca/product/xbox-series-x-1tb-console-new-model-online-only/14964951' + }, + { + brand: 'microsoft', + model: 'xbox series s', + series: 'xboxss', + url: + 'https://www.bestbuy.ca/en-ca/product/xbox-series-s-512gb-console-new-model-online-only/14964950' } ], name: 'bestbuy-ca', diff --git a/src/store/model/bestbuy.ts b/src/store/model/bestbuy.ts index 507c60b841..a46abf7bde 100644 --- a/src/store/model/bestbuy.ts +++ b/src/store/model/bestbuy.ts @@ -9,8 +9,7 @@ export const BestBuy: Store = { }, maxPrice: { container: - '[data-sticky-media-gallery] .priceView-price .priceView-hero-price span', - euroFormat: false + '[data-sticky-media-gallery] .priceView-price .priceView-hero-price span' } }, links: [