Skip to content

Commit

Permalink
changes breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
okbel committed Jan 17, 2021
1 parent 7f70cfd commit de0ba8c
Show file tree
Hide file tree
Showing 33 changed files with 89 additions and 74 deletions.
9 changes: 5 additions & 4 deletions components/cart/CartItem/CartItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { ChangeEvent, useEffect, useState } from 'react'
import cn from 'classnames'
import Image from 'next/image'
import Link from 'next/link'
import s from './CartItem.module.css'
import { Trash, Plus, Minus } from '@components/icons'
import usePrice from '@framework/product/use-price'
import useUpdateItem from '@framework/cart/use-update-item'
import useRemoveItem from '@framework/cart/use-remove-item'
import s from './CartItem.module.css'
import { CartItem } from 'framework/types'

const CartItem = ({
const Item = ({
item,
currencyCode,
}: {
Expand All @@ -31,7 +32,7 @@ const CartItem = ({
const val = Number(e.target.value)

if (Number.isInteger(val) && val >= 0) {
setQuantity(e.target.value)
setQuantity(Number(e.target.value))
}
}
const handleBlur = () => {
Expand Down Expand Up @@ -124,4 +125,4 @@ const CartItem = ({
)
}

export default CartItem
export default Item
2 changes: 1 addition & 1 deletion components/common/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FC } from 'react'
import cn from 'classnames'
import Link from 'next/link'
import { useRouter } from 'next/router'
import type { Page } from '@framework/api/operations/get-all-pages'
import type { Page } from '@framework/common/get-all-pages'
import getSlug from '@lib/get-slug'
import { Github, Vercel } from '@components/icons'
import { Logo, Container } from '@components/ui'
Expand Down
2 changes: 1 addition & 1 deletion components/common/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import CartSidebarView from '@components/cart/CartSidebarView'

import LoginView from '@components/auth/LoginView'
import { CommerceProvider } from '@framework'
import type { Page } from '@framework/api/operations/get-all-pages'
import type { Page } from '@framework/common/get-all-pages'

const Loading = () => (
<div className="w-80 h-80 flex items-center text-center justify-center p-3">
Expand Down
2 changes: 1 addition & 1 deletion framework/bigcommerce/api/catalog/handlers/get-products.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Product } from 'framework/types'
import getAllProducts, { ProductEdge } from '../../operations/get-all-products'
import getAllProducts, { ProductEdge } from '../../../product/get-all-products'
import type { ProductsHandlers } from '../products'

const SORT: { [key: string]: string | undefined } = {
Expand Down
2 changes: 1 addition & 1 deletion framework/bigcommerce/api/customers/handlers/login.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FetcherError } from '@commerce/utils/errors'
import login from '../../operations/login'
import login from '../../../auth/login'
import type { LoginHandlers } from '../login'

const invalidCredentials = /invalid credentials/i
Expand Down
2 changes: 1 addition & 1 deletion framework/bigcommerce/api/customers/handlers/signup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BigcommerceApiError } from '../../utils/errors'
import login from '../../operations/login'
import login from '../../../auth/login'
import { SignupHandlers } from '../signup'

const signup: SignupHandlers['signup'] = async ({
Expand Down
2 changes: 1 addition & 1 deletion framework/bigcommerce/api/utils/set-product-locale-meta.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ProductNode } from '../operations/get-all-products'
import type { ProductNode } from '../../product/get-all-products'
import type { RecursivePartial } from './types'

export default function setProductLocaleMeta(
Expand Down
4 changes: 2 additions & 2 deletions framework/bigcommerce/api/wishlist/handlers/add-item.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { WishlistHandlers } from '..'
import getCustomerId from '../../operations/get-customer-id'
import getCustomerWishlist from '../../operations/get-customer-wishlist'
import getCustomerId from '../../../customer/get-customer-id'
import getCustomerWishlist from '../../../customer/get-customer-wishlist'
import { parseWishlistItem } from '../../utils/parse-item'

// Returns the wishlist of the signed customer
Expand Down
4 changes: 2 additions & 2 deletions framework/bigcommerce/api/wishlist/handlers/get-wishlist.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import getCustomerId from '../../operations/get-customer-id'
import getCustomerWishlist from '../../operations/get-customer-wishlist'
import getCustomerId from '../../../customer/get-customer-id'
import getCustomerWishlist from '../../../customer/get-customer-wishlist'
import type { Wishlist, WishlistHandlers } from '..'

// Return wishlist info
Expand Down
4 changes: 2 additions & 2 deletions framework/bigcommerce/api/wishlist/handlers/remove-item.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import getCustomerId from '../../operations/get-customer-id'
import getCustomerId from '../../../customer/get-customer-id'
import getCustomerWishlist, {
Wishlist,
} from '../../operations/get-customer-wishlist'
} from '../../../customer/get-customer-wishlist'
import type { WishlistHandlers } from '..'

// Return current wishlist info
Expand Down
2 changes: 1 addition & 1 deletion framework/bigcommerce/api/wishlist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { BigcommerceApiError } from '../utils/errors'
import type {
Wishlist,
WishlistItem,
} from '../operations/get-customer-wishlist'
} from '../../customer/get-customer-wishlist'
import getWishlist from './handlers/get-wishlist'
import addItem from './handlers/add-item'
import removeItem from './handlers/remove-item'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { ServerResponse } from 'http'
import type { LoginMutation, LoginMutationVariables } from '../../schema'
import type { RecursivePartial } from '../utils/types'
import concatHeader from '../utils/concat-cookie'
import { BigcommerceConfig, getConfig } from '..'
import type { LoginMutation, LoginMutationVariables } from '../schema'
import type { RecursivePartial } from '../api/utils/types'
import concatHeader from '../api/utils/concat-cookie'
import { BigcommerceConfig, getConfig } from '../api'

export const loginMutation = /* GraphQL */ `
mutation login($email: String!, $password: String!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RecursivePartial, RecursiveRequired } from '../utils/types'
import { BigcommerceConfig, getConfig } from '..'
import { definitions } from '../definitions/store-content'
import type { RecursivePartial, RecursiveRequired } from '../api/utils/types'
import { BigcommerceConfig, getConfig } from '../api'
import { definitions } from '../api/definitions/store-content'

export type Page = definitions['page_Full']

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RecursivePartial, RecursiveRequired } from '../utils/types'
import { BigcommerceConfig, getConfig } from '..'
import { definitions } from '../definitions/store-content'
import type { RecursivePartial, RecursiveRequired } from '../api/utils/types'
import { BigcommerceConfig, getConfig } from '../api'
import { definitions } from '../api/definitions/store-content'

export type Page = definitions['page_Full']

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { GetSiteInfoQuery, GetSiteInfoQueryVariables } from '../../schema'
import type { RecursivePartial, RecursiveRequired } from '../utils/types'
import filterEdges from '../utils/filter-edges'
import { BigcommerceConfig, getConfig } from '..'
import { categoryTreeItemFragment } from '../fragments/category-tree'
import type { GetSiteInfoQuery, GetSiteInfoQueryVariables } from '../schema'
import type { RecursivePartial, RecursiveRequired } from '../api/utils/types'
import filterEdges from '../api/utils/filter-edges'
import { BigcommerceConfig, getConfig } from '../api'
import { categoryTreeItemFragment } from '../api/fragments/category-tree'

// Get 3 levels of categories
export const getSiteInfoQuery = /* GraphQL */ `
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GetCustomerIdQuery } from '../../schema'
import { BigcommerceConfig, getConfig } from '..'
import { GetCustomerIdQuery } from '../schema'
import { BigcommerceConfig, getConfig } from '../api'

export const getCustomerIdQuery = /* GraphQL */ `
query getCustomerId {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { RecursivePartial, RecursiveRequired } from '../utils/types'
import { definitions } from '../definitions/wishlist'
import { BigcommerceConfig, getConfig } from '..'
import getAllProducts, { ProductEdge } from './get-all-products'
import type { RecursivePartial, RecursiveRequired } from '../api/utils/types'
import { definitions } from '../api/definitions/wishlist'
import { BigcommerceConfig, getConfig } from '../api'
import getAllProducts, { ProductEdge } from '../product/get-all-products'

export type Wishlist = Omit<definitions['wishlist_Full'], 'items'> & {
items?: WishlistItem[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type {
GetAllProductPathsQuery,
GetAllProductPathsQueryVariables,
} from '../../schema'
import type { RecursivePartial, RecursiveRequired } from '../utils/types'
import filterEdges from '../utils/filter-edges'
import { BigcommerceConfig, getConfig } from '..'
} from '../schema'
import type { RecursivePartial, RecursiveRequired } from '../api/utils/types'
import filterEdges from '../api/utils/filter-edges'
import { BigcommerceConfig, getConfig } from '../api'

export const getAllProductPathsQuery = /* GraphQL */ `
query getAllProductPaths($first: Int = 100) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type {
GetAllProductsQuery,
GetAllProductsQueryVariables,
} from '../../schema'
import type { RecursivePartial, RecursiveRequired } from '../utils/types'
import filterEdges from '../utils/filter-edges'
import setProductLocaleMeta from '../utils/set-product-locale-meta'
import { productConnectionFragment } from '../fragments/product'
import { BigcommerceConfig, getConfig } from '..'
import { normalizeProduct } from '../../lib/normalize'
} from '../schema'
import type { RecursivePartial, RecursiveRequired } from '../api/utils/types'
import filterEdges from '../api/utils/filter-edges'
import setProductLocaleMeta from '../api/utils/set-product-locale-meta'
import { productConnectionFragment } from '../api/fragments/product'
import { BigcommerceConfig, getConfig } from '../api'
import { normalizeProduct } from '../lib/normalize'

export const getAllProductsQuery = /* GraphQL */ `
query getAllProducts(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { GetProductQuery, GetProductQueryVariables } from '../../schema'
import setProductLocaleMeta from '../utils/set-product-locale-meta'
import { productInfoFragment } from '../fragments/product'
import { BigcommerceConfig, getConfig } from '..'
import type { GetProductQuery, GetProductQueryVariables } from '../schema'
import setProductLocaleMeta from '../api/utils/set-product-locale-meta'
import { productInfoFragment } from '../api/fragments/product'
import { BigcommerceConfig, getConfig } from '../api'
import { normalizeProduct } from '@framework/lib/normalize'

export const getProductQuery = /* GraphQL */ `
Expand Down
4 changes: 2 additions & 2 deletions framework/bigcommerce/product/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as usePrice } from './use-price'
export { default as useSearch } from './use-search'
export { default as getProduct } from '../api/operations/get-product'
export { default as getAllProducts } from '../api/operations/get-all-products'
export { default as getProduct } from './get-product'
export { default as getAllProducts } from './get-all-products'
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"bowser": "^2.11.0",
"classnames": "^2.2.6",
"cookie": "^0.4.1",
"dot-object": "^2.1.4",
"email-validator": "^2.0.4",
"js-cookie": "^2.2.1",
"keen-slider": "^5.2.4",
Expand Down Expand Up @@ -100,8 +101,8 @@
"resolutions": {
"webpack": "5.11.1"
},
"node": {
"net": "empty"
"engines": {
"node": ">=14"
},
"license": "MIT"
}
4 changes: 2 additions & 2 deletions pages/[...pages].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { Layout } from '@components/common'
import getSlug from '@lib/get-slug'
import { missingLocaleInPages } from '@lib/usage-warns'
import { getConfig } from '@framework/api'
import getPage from '@framework/api/operations/get-page'
import getAllPages from '@framework/api/operations/get-all-pages'
import getPage from '@framework/common/get-page'
import getAllPages from '@framework/common/get-all-pages'
import { defaultPageProps } from '@lib/defaults'

export async function getStaticProps({
Expand Down
2 changes: 1 addition & 1 deletion pages/blog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GetStaticPropsContext } from 'next'
import { getConfig } from '@framework/api'
import getAllPages from '@framework/api/operations/get-all-pages'
import getAllPages from '@framework/common/get-all-pages'
import { Layout } from '@components/common'
import { Container } from '@components/ui'

Expand Down
2 changes: 1 addition & 1 deletion pages/cart.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GetStaticPropsContext } from 'next'
import { getConfig } from '@framework/api'
import getAllPages from '@framework/api/operations/get-all-pages'
import getAllPages from '@framework/common/get-all-pages'
import useCart from '@framework/cart/use-cart'
import usePrice from '@framework/product/use-price'
import { Layout } from '@components/common'
Expand Down
6 changes: 3 additions & 3 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import HomeAllProductsGrid from '@components/common/HomeAllProductsGrid'
import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next'

import { getConfig } from '@framework/api'
import getAllProducts from '@framework/api/operations/get-all-products'
import getSiteInfo from '@framework/api/operations/get-site-info'
import getAllPages from '@framework/api/operations/get-all-pages'
import getAllProducts from '@framework/product/get-all-products'
import getSiteInfo from '@framework/common/get-site-info'
import getAllPages from '@framework/common/get-all-pages'

export async function getStaticProps({
preview,
Expand Down
2 changes: 1 addition & 1 deletion pages/orders.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GetStaticPropsContext } from 'next'
import { getConfig } from '@framework/api'
import getAllPages from '@framework/api/operations/get-all-pages'
import getAllPages from '@framework/common/get-all-pages'
import { Layout } from '@components/common'
import { Container, Text } from '@components/ui'
import { Bag } from '@components/icons'
Expand Down
6 changes: 3 additions & 3 deletions pages/product/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { Layout } from '@components/common'
import { ProductView } from '@components/product'

import { getConfig } from '@framework/api'
import getProduct from '@framework/api/operations/get-product'
import getAllPages from '@framework/api/operations/get-all-pages'
import getAllProductPaths from '@framework/api/operations/get-all-product-paths'
import getProduct from '@framework/product/get-product'
import getAllPages from '@framework/common/get-all-pages'
import getAllProductPaths from '@framework/product/get-all-product-paths'

export async function getStaticProps({
params,
Expand Down
2 changes: 1 addition & 1 deletion pages/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GetStaticPropsContext } from 'next'
import { getConfig } from '@framework/api'
import getAllPages from '@framework/api/operations/get-all-pages'
import getAllPages from '@framework/common/get-all-pages'
import useCustomer from '@framework/customer/use-customer'
import { Layout } from '@components/common'
import { Container, Text } from '@components/ui'
Expand Down
4 changes: 2 additions & 2 deletions pages/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { ProductCard } from '@components/product'
import { Container, Grid, Skeleton } from '@components/ui'

import { getConfig } from '@framework/api'
import getAllPages from '@framework/api/operations/get-all-pages'
import getSiteInfo from '@framework/api/operations/get-site-info'
import useSearch from '@framework/product/use-search'
import getAllPages from '@framework/common/get-all-pages'
import getSiteInfo from '@framework/common/get-site-info'

import rangeMap from '@lib/range-map'

Expand Down
2 changes: 1 addition & 1 deletion pages/wishlist.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GetStaticPropsContext } from 'next'
import { getConfig } from '@framework/api'
import getAllPages from '@framework/api/operations/get-all-pages'
import getAllPages from '@framework/common/get-all-pages'
import useWishlist from '@framework/wishlist/use-wishlist'
import { Layout } from '@components/common'
import { Heart } from '@components/icons'
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
}
},
"include": [
"/framework/types.d.ts",
"next-env.d.ts",
"framework/types.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.js"
Expand Down
15 changes: 14 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2346,6 +2346,11 @@ commander@^2.13.0, commander@^2.16.0, commander@^2.20.0, commander@^2.20.3, comm
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==

commander@^4.0.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==

commander@^5.0.0, commander@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
Expand Down Expand Up @@ -2982,6 +2987,14 @@ dot-case@^3.0.3:
no-case "^3.0.4"
tslib "^2.0.3"

dot-object@^2.1.4:
version "2.1.4"
resolved "https://registry.yarnpkg.com/dot-object/-/dot-object-2.1.4.tgz#c6c54e9fca510b4d0ea4d65acf33726963843b5f"
integrity sha512-7FXnyyCLFawNYJ+NhkqyP9Wd2yzuo+7n9pGiYpkmXCTYa8Ci2U0eUNDVg5OuO5Pm6aFXI2SWN8/N/w7SJWu1WA==
dependencies:
commander "^4.0.0"
glob "^7.1.5"

dotenv@^8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
Expand Down Expand Up @@ -3618,7 +3631,7 @@ glob@^6.0.1:
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.6:
glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.5, glob@^7.1.6:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
Expand Down

0 comments on commit de0ba8c

Please sign in to comment.