From a6b586f324ad2d2d9526c72cd561814e1112c4e5 Mon Sep 17 00:00:00 2001 From: "Brian.Jiang2021" Date: Fri, 3 Mar 2023 16:46:25 +0800 Subject: [PATCH] feat: bc shopping list and junior buyer shopping list https://bigc-b2b.atlassian.net/browse/BUN-624 https://bigc-b2b.atlassian.net/browse/BUN-661 --- .../src/components/filter/B3Filter.tsx | 18 +- .../components/CreateShoppingList.tsx | 16 +- .../orderDetail/components/OrderAction.tsx | 8 +- .../orderDetail/components/OrderDialog.tsx | 21 +- .../components/OrderShoppingList.tsx | 50 +++-- apps/storefront/src/pages/pdp/PDP.tsx | 19 +- .../src/pages/quickorder/Quickorder.tsx | 2 + .../pages/quickorder/components/QuickAdd.tsx | 15 +- .../components/QuickOrderFooter.tsx | 17 +- .../storefront/src/pages/quote/QuoteDraft.tsx | 1 + .../src/pages/quote/components/AddToQuote.tsx | 3 + .../quote/components/QuoteDetailTable.tsx | 2 +- .../ShoppingListDetails.tsx | 70 ++++-- .../components/AddToShoppingList.tsx | 10 +- .../components/ChooseOptionsDialog.tsx | 7 +- .../components/QuickAdd.tsx | 16 +- .../components/SearchProduct.tsx | 7 +- .../components/ShoppingDetailFooter.tsx | 7 +- .../components/ShoppingDetailHeader.tsx | 56 +++-- .../components/ShoppingDetailTable.tsx | 11 +- .../shoppingLists/AddEditShoppingLists.tsx | 27 ++- .../src/pages/shoppingLists/ShoppingLists.tsx | 29 ++- .../pages/shoppingLists/ShoppingListsCard.tsx | 42 ++-- .../src/pages/shoppingLists/config.ts | 2 + apps/storefront/src/shared/routes/routes.ts | 4 +- .../src/shared/service/b2b/graphql/product.ts | 8 + .../service/b2b/graphql/shoppingList.ts | 209 ++++++++++++++++++ .../src/shared/service/b2b/index.ts | 22 ++ 28 files changed, 589 insertions(+), 110 deletions(-) diff --git a/apps/storefront/src/components/filter/B3Filter.tsx b/apps/storefront/src/components/filter/B3Filter.tsx index a0717a4d..eadffe34 100644 --- a/apps/storefront/src/components/filter/B3Filter.tsx +++ b/apps/storefront/src/components/filter/B3Filter.tsx @@ -68,6 +68,7 @@ interface B3FilterProps { handleChange: (key: string, value: string) => void handleFilterChange: (value: Y) => void handleFilterCustomButtomClick?: () => void + showB3FilterMoreIcon?: boolean, } const B3Filter: (props: B3FilterProps) => ReactElement = (props) => { @@ -80,6 +81,7 @@ const B3Filter: (props: B3FilterProps) => ReactElement = (props) => handleChange, handleFilterChange, handleFilterCustomButtomClick, + showB3FilterMoreIcon = true, } = props const [isMobile] = useMobile() @@ -125,12 +127,16 @@ const B3Filter: (props: B3FilterProps) => ReactElement = (props) => handleChange={handleSearchChange} w="70%" /> - + { + showB3FilterMoreIcon && ( + + ) + } -1) { data.description = description.split('\n').join('\\n') } - const createShoppingData = { - ...data, - status: +role === 2 ? 30 : 0, + const createSL = isB2BUser ? createB2BShoppingList : createBcShoppingList + + const createShoppingData = data + if (isB2BUser) { + createShoppingData.status = +role === 2 ? 30 : 0 + } else { + createShoppingData.channelId = currentChannelId } - await createB2BShoppingList(createShoppingData) + + await createSL(createShoppingData) setLoading(false) onChange() })() diff --git a/apps/storefront/src/pages/orderDetail/components/OrderAction.tsx b/apps/storefront/src/pages/orderDetail/components/OrderAction.tsx index 80da8092..490ce9dc 100644 --- a/apps/storefront/src/pages/orderDetail/components/OrderAction.tsx +++ b/apps/storefront/src/pages/orderDetail/components/OrderAction.tsx @@ -124,6 +124,7 @@ interface OrderCardProps { itemKey: string, orderId: string, currencyInfo: OrderCurrency, + role: number | string, } interface DialogData{ @@ -143,6 +144,7 @@ const OrderCard = (props: OrderCardProps) => { itemKey, orderId, currencyInfo, + role, } = props const { @@ -195,7 +197,7 @@ const OrderCard = (props: OrderCardProps) => { } else if (name === 'printInvoice') { window.open(`/account.php?action=print_invoice&order_id=${orderId}`) } else { - if (!isAgenting) { + if (!isAgenting && +role === 3) { snackbar.error('To re-order, return or add product to shopping list, please masquerade') return } @@ -310,6 +312,7 @@ export const OrderAction = (props: OrderActionProps) => { const { state: { isB2BUser, + role, }, } = useContext(GlobaledContext) @@ -417,7 +420,7 @@ export const OrderAction = (props: OrderActionProps) => { key: 'add-to-shopping-list', name: 'shoppingList', variant: 'outlined', - isCanShow: isB2BUser, + isCanShow: true, }, ] @@ -470,6 +473,7 @@ export const OrderAction = (props: OrderActionProps) => { currencyInfo={money!} {...item} itemKey={item.key} + role={role} /> )) } diff --git a/apps/storefront/src/pages/orderDetail/components/OrderDialog.tsx b/apps/storefront/src/pages/orderDetail/components/OrderDialog.tsx index 0c70c1ab..dee8af5d 100644 --- a/apps/storefront/src/pages/orderDetail/components/OrderDialog.tsx +++ b/apps/storefront/src/pages/orderDetail/components/OrderDialog.tsx @@ -2,6 +2,7 @@ import { useState, ReactElement, useEffect, + useContext, } from 'react' import { @@ -15,7 +16,9 @@ import { import { addProductToShoppingList, + addProductToBcShoppingList, getB2BVariantInfoBySkus, + getBcVariantInfoBySkus, } from '@/shared/service/b2b' import { @@ -24,6 +27,10 @@ import { addProductToCart, } from '@/shared/service/bc' +import { + GlobaledContext, +} from '@/shared/global' + import { B3CustomForm, B3Dialog, @@ -99,6 +106,12 @@ export const OrderDialog: (props: OrderDialogProps) => ReactElement = ({ itemKey, currencyInfo, }) => { + const { + state: { + isB2BUser, + }, + } = useContext(GlobaledContext) + const [isOpenCreateShopping, setOpenCreateShopping] = useState(false) const [openShoppingList, setOpenShoppingList] = useState(false) @@ -135,9 +148,11 @@ export const OrderDialog: (props: OrderDialogProps) => ReactElement = ({ const getVariantInfoByList = async () => { const skus = products.map((product) => product.sku) + const getVariantInfoBySku = isB2BUser ? getB2BVariantInfoBySkus : getBcVariantInfoBySkus + const { variantSku: variantInfoList = [], - }: CustomFieldItems = await getB2BVariantInfoBySkus({ + }: CustomFieldItems = await getVariantInfoBySku({ skus, }) @@ -301,7 +316,9 @@ export const OrderDialog: (props: OrderDialogProps) => ReactElement = ({ }) const params = items.filter((item) => checkedArr.includes(+item.variantId)) - await addProductToShoppingList({ + const addToShoppingList = isB2BUser ? addProductToShoppingList : addProductToBcShoppingList + + await addToShoppingList({ shoppingListId: +id, items: params, }) diff --git a/apps/storefront/src/pages/orderDetail/components/OrderShoppingList.tsx b/apps/storefront/src/pages/orderDetail/components/OrderShoppingList.tsx index d063ccfa..d0a77675 100644 --- a/apps/storefront/src/pages/orderDetail/components/OrderShoppingList.tsx +++ b/apps/storefront/src/pages/orderDetail/components/OrderShoppingList.tsx @@ -1,6 +1,7 @@ import { useState, useEffect, + useContext, } from 'react' import { @@ -15,8 +16,13 @@ import styled from '@emotion/styled' import { getB2BShoppingList, + getBcShoppingList, } from '@/shared/service/b2b' +import { + GlobaledContext, +} from '@/shared/global' + import { B3Dialog, } from '@/components' @@ -67,20 +73,34 @@ export const OrderShoppingList = (props: orderShoppingListProps) => { setLoading = noop, } = props + const { + state: { + isB2BUser, + currentChannelId, + }, + } = useContext(GlobaledContext) + const [list, setList] = useState([]) const [activeId, setActiveId] = useState('') const getList = async () => { setLoading(true) setList([]) + + const getShoppingList = isB2BUser ? getB2BShoppingList : getBcShoppingList + const infoKey = isB2BUser ? 'shoppingLists' : 'customerShoppingLists' + const params = isB2BUser ? {} : { + channelId: currentChannelId, + } + try { const { - shoppingLists: { + [infoKey]: { edges: list = [], }, - }: CustomFieldItems = await getB2BShoppingList() + }: CustomFieldItems = await getShoppingList(params) - const newList = list.filter((item: CustomFieldItems) => item.node.status === 0) + const newList = list.filter((item: CustomFieldItems) => (isB2BUser ? item.node.status === 0 : true)) setList(newList) } finally { @@ -137,18 +157,18 @@ export const OrderShoppingList = (props: orderShoppingListProps) => { }} > { - list.map((item: ListItem) => ( - - - {item.node.name} - - - )) - } + list.map((item: ListItem) => ( + + + {item.node.name} + + + )) + } diff --git a/apps/storefront/src/pages/pdp/PDP.tsx b/apps/storefront/src/pages/pdp/PDP.tsx index 97f1b2b5..36b5666b 100644 --- a/apps/storefront/src/pages/pdp/PDP.tsx +++ b/apps/storefront/src/pages/pdp/PDP.tsx @@ -4,6 +4,7 @@ import { Dispatch, SetStateAction, useRef, + useContext, } from 'react' import { @@ -27,9 +28,15 @@ import { import { searchB2BProducts, + searchBcProducts, addProductToShoppingList, + addProductToBcShoppingList, } from '@/shared/service/b2b' +import { + GlobaledContext, +} from '@/shared/global' + import { OrderShoppingList, } from '../orderDetail/components/OrderShoppingList' @@ -101,6 +108,11 @@ const PDP = ({ setOpenPage, }: PDPProps) => { const isPromission = true + const { + state: { + isB2BUser, + }, + } = useContext(GlobaledContext) const pdpRef = useRef({ timer: null, @@ -179,10 +191,11 @@ const PDP = ({ } = getDefaultCurrencyInfo() const companyId = B3SStorage.get('B3CompanyInfo')?.id || B3SStorage.get('salesRepCompanyId') + const getProducts = isB2BUser ? searchB2BProducts : searchBcProducts const { productsSearch, - } = await searchB2BProducts({ + } = await getProducts({ productIds: [+productId], currencyCode, companyId, @@ -216,7 +229,9 @@ const PDP = ({ optionList, } - await addProductToShoppingList({ + const addToShoppingList = isB2BUser ? addProductToShoppingList : addProductToBcShoppingList + + await addToShoppingList({ shoppingListId: +id, items: [params], }) diff --git a/apps/storefront/src/pages/quickorder/Quickorder.tsx b/apps/storefront/src/pages/quickorder/Quickorder.tsx index ca17344d..473420ce 100644 --- a/apps/storefront/src/pages/quickorder/Quickorder.tsx +++ b/apps/storefront/src/pages/quickorder/Quickorder.tsx @@ -34,6 +34,7 @@ const Quickorder = () => { state: { role, isAgenting, + isB2BUser, }, } = useContext(GlobaledContext) @@ -109,6 +110,7 @@ const Quickorder = () => { checkedArr={checkedArr} isAgenting={isAgenting} setIsRequestLoading={setIsRequestLoading} + isB2BUser={isB2BUser} /> diff --git a/apps/storefront/src/pages/quickorder/components/QuickAdd.tsx b/apps/storefront/src/pages/quickorder/components/QuickAdd.tsx index b7ea20ca..f774cefb 100644 --- a/apps/storefront/src/pages/quickorder/components/QuickAdd.tsx +++ b/apps/storefront/src/pages/quickorder/components/QuickAdd.tsx @@ -2,6 +2,7 @@ import { useState, useEffect, KeyboardEventHandler, + useContext, } from 'react' import { @@ -28,6 +29,10 @@ import { snackbar, } from '@/utils' +import { + GlobaledContext, +} from '@/shared/global' + import { getQuickAddRowFields, } from '../../shoppingListDetails/shared/config' @@ -39,6 +44,7 @@ import { import { getB2BVariantInfoBySkus, + getBcVariantInfoBySkus, } from '../../../shared/service/b2b' interface AddToListContentProps { @@ -56,6 +62,12 @@ export const QuickAdd = (props: AddToListContentProps) => { buttonText = 'Add product to list', } = props + const { + state: { + isB2BUser, + }, + } = useContext(GlobaledContext) + const b3Lang = useB3Lang() const [rows, setRows] = useState(level) @@ -269,10 +281,11 @@ export const QuickAdd = (props: AddToListContentProps) => { } const getVariantList = async (skus: string[]) => { + const getVariantInfoBySku = isB2BUser ? getB2BVariantInfoBySkus : getBcVariantInfoBySkus try { const { variantSku: variantInfoList, - }: CustomFieldItems = await getB2BVariantInfoBySkus({ + }: CustomFieldItems = await getVariantInfoBySku({ skus, }, true) diff --git a/apps/storefront/src/pages/quickorder/components/QuickOrderFooter.tsx b/apps/storefront/src/pages/quickorder/components/QuickOrderFooter.tsx index 6cdbe4ad..a5336a51 100644 --- a/apps/storefront/src/pages/quickorder/components/QuickOrderFooter.tsx +++ b/apps/storefront/src/pages/quickorder/components/QuickOrderFooter.tsx @@ -33,7 +33,9 @@ import { import { searchB2BProducts, + searchBcProducts, addProductToShoppingList, + addProductToBcShoppingList, } from '@/shared/service/b2b' import { @@ -54,6 +56,7 @@ import { import { getB2BVariantInfoBySkus, + getBcVariantInfoBySkus, } from '@/shared/service/b2b/graphql/product' import { @@ -146,6 +149,7 @@ interface QuickOrderFooterProps { checkedArr: CustomFieldItems, isAgenting: boolean, setIsRequestLoading: Dispatch>, + isB2BUser: boolean, } const QuickOrderFooter = (props: QuickOrderFooterProps) => { @@ -154,6 +158,7 @@ const QuickOrderFooter = (props: QuickOrderFooterProps) => { checkedArr, isAgenting, setIsRequestLoading, + isB2BUser, } = props const [isMobile] = useMobile() @@ -239,12 +244,14 @@ const QuickOrderFooter = (props: QuickOrderFooterProps) => { skus.push(node.variantSku) }) + const getVariantInfoBySku = isB2BUser ? getB2BVariantInfoBySkus : getBcVariantInfoBySkus + if (skus.length === 0) { snackbar.error('Please select at least one item to add to cart') return } - const getInventoryInfos = await getB2BVariantInfoBySkus({ + const getInventoryInfos = await getVariantInfoBySku({ skus, }) @@ -317,9 +324,11 @@ const QuickOrderFooter = (props: QuickOrderFooterProps) => { } }) + const getProducts = isB2BUser ? searchB2BProducts : searchBcProducts + const { productsSearch, - } = await searchB2BProducts({ + } = await getProducts({ productIds, }) @@ -470,7 +479,9 @@ const QuickOrderFooter = (props: QuickOrderFooterProps) => { }) }) - await addProductToShoppingList({ + const addToShoppingList = isB2BUser ? addProductToShoppingList : addProductToBcShoppingList + + await addToShoppingList({ shoppingListId: +shoppingListId, items, }) diff --git a/apps/storefront/src/pages/quote/QuoteDraft.tsx b/apps/storefront/src/pages/quote/QuoteDraft.tsx index 9e2c02b4..2875d769 100644 --- a/apps/storefront/src/pages/quote/QuoteDraft.tsx +++ b/apps/storefront/src/pages/quote/QuoteDraft.tsx @@ -786,6 +786,7 @@ const QuoteDraft = ({ diff --git a/apps/storefront/src/pages/quote/components/AddToQuote.tsx b/apps/storefront/src/pages/quote/components/AddToQuote.tsx index 7b64d49e..a3d2cc99 100644 --- a/apps/storefront/src/pages/quote/components/AddToQuote.tsx +++ b/apps/storefront/src/pages/quote/components/AddToQuote.tsx @@ -31,12 +31,14 @@ import { interface AddToListProps { updateList: () => void addToQuote: (products: CustomFieldItems[]) => void, + isB2BUser: boolean, } export const AddToQuote = (props: AddToListProps) => { const { updateList, addToQuote, + isB2BUser, } = props const getNewQuoteProduct = (products: CustomFieldItems[]) => products.map((product) => { @@ -136,6 +138,7 @@ export const AddToQuote = (props: AddToListProps) => { addToList={addToList} searchDialogTitle="Add to quote" addButtonText="Add to Quote" + isB2BUser={isB2BUser} /> diff --git a/apps/storefront/src/pages/quote/components/QuoteDetailTable.tsx b/apps/storefront/src/pages/quote/components/QuoteDetailTable.tsx index a8260670..259e22bf 100644 --- a/apps/storefront/src/pages/quote/components/QuoteDetailTable.tsx +++ b/apps/storefront/src/pages/quote/components/QuoteDetailTable.tsx @@ -164,7 +164,7 @@ const QuoteDetailTable = (props: ShoppingDetailTableProps, ref: Ref) => lineHeight: '1.5', color: '#455A64', }} - key={`${option.optionName}_keyName`} + key={`${option.optionName}_${option.optionLabel}`} > {`${option.optionName }: ${option.optionLabel diff --git a/apps/storefront/src/pages/shoppingListDetails/ShoppingListDetails.tsx b/apps/storefront/src/pages/shoppingListDetails/ShoppingListDetails.tsx index 20b37b8a..0b476b6b 100644 --- a/apps/storefront/src/pages/shoppingListDetails/ShoppingListDetails.tsx +++ b/apps/storefront/src/pages/shoppingListDetails/ShoppingListDetails.tsx @@ -21,9 +21,13 @@ import { import { searchB2BProducts, + searchBcProducts, getB2BShoppingListDetails, + getBcShoppingListDetails, deleteB2BShoppingListItem, + deleteBcShoppingListItem, updateB2BShoppingList, + updateBcShoppingList, } from '@/shared/service/b2b' import { @@ -70,6 +74,14 @@ interface TableRefProps extends HTMLInputElement { initSearch: () => void, } +interface UpdateShoppingListParamsProps { + id: number, + name: string, + description: string, + status?: number, + channelId?: number, +} + // shoppingList status: 0 -- Approved; 20 -- Rejected; 30 -- Draft; 40 -- Ready for approval // 0: Admin, 1: Senior buyer, 2: Junior buyer, 3: Super admin @@ -83,6 +95,8 @@ const ShoppingListDetails = () => { companyInfo: { id: companyInfoId, }, + isB2BUser, + currentChannelId, }, } = useContext(GlobaledContext) const navigate = useNavigate() @@ -137,11 +151,12 @@ const ShoppingListDetails = () => { productIds.push(node.productId) } }) + const getProducts = isB2BUser ? searchB2BProducts : searchBcProducts try { const { productsSearch, - } = await searchB2BProducts({ + } = await getProducts({ productIds, currencyCode, companyId: companyInfoId, @@ -173,24 +188,27 @@ const ShoppingListDetails = () => { } const getShoppingListDetails = async (params: SearchProps) => { - const { - shoppingList, - shoppingList: { - customerInfo, - products: { - edges, - totalCount, - }, - }, - } = await getB2BShoppingListDetails({ + const getSLDetail = isB2BUser ? getB2BShoppingListDetails : getBcShoppingListDetails + const infoKey = isB2BUser ? 'shoppingList' : 'customerShoppingList' + + const shoppingListInfos = await getSLDetail({ id, ...params, }) + const shoppingListDetailInfo = shoppingListInfos[infoKey] + + const { + products: { + edges, + totalCount, + }, + } = shoppingListDetailInfo + const listProducts = await handleGetProductsById(edges) - setCustomerInfo(customerInfo) - setShoppingListInfo(shoppingList) + if (isB2BUser) setCustomerInfo(shoppingListDetailInfo.customerInfo) + setShoppingListInfo(shoppingListDetailInfo) return { edges: listProducts, totalCount, @@ -200,12 +218,20 @@ const ShoppingListDetails = () => { const handleUpdateShoppingList = async (status: number) => { setIsRequestLoading(true) try { - await updateB2BShoppingList({ - id, + const updateShoppingList = isB2BUser ? updateB2BShoppingList : updateBcShoppingList + const params: UpdateShoppingListParamsProps = { + id: +id, name: shoppingListInfo?.name || '', description: shoppingListInfo?.description || '', - status, - }) + } + + if (isB2BUser) { + params.status = status + } else { + params.channelId = currentChannelId + } + + await updateShoppingList(params) snackbar.success('Shipping list status updated successfully') tableRef.current?.initSearch() @@ -216,9 +242,11 @@ const ShoppingListDetails = () => { const handleDeleteItems = async (itemId: number | string = '') => { setIsRequestLoading(true) + const deleteShoppingListItem = isB2BUser ? deleteB2BShoppingListItem : deleteBcShoppingListItem + try { if (itemId) { - await deleteB2BShoppingListItem({ + await deleteShoppingListItem({ itemId, shoppingListId: id, }) @@ -241,7 +269,7 @@ const ShoppingListDetails = () => { node, } = item - await deleteB2BShoppingListItem({ + await deleteShoppingListItem({ itemId: node.itemId, shoppingListId: id, }) @@ -299,6 +327,7 @@ const ShoppingListDetails = () => { }} > { getShoppingListDetails={getShoppingListDetails} setDeleteOpen={setDeleteOpen} setDeleteItemId={setDeleteItemId} + isB2BUser={isB2BUser} /> @@ -370,6 +400,7 @@ const ShoppingListDetails = () => { (!isReadForApprove && !isJuniorApprove) && ( ) } @@ -388,6 +419,7 @@ const ShoppingListDetails = () => { setDeleteOpen={setDeleteOpen} setValidateFailureProducts={setValidateFailureProducts} setValidateSuccessProducts={setValidateSuccessProducts} + isB2BUser={isB2BUser} /> ) } diff --git a/apps/storefront/src/pages/shoppingListDetails/components/AddToShoppingList.tsx b/apps/storefront/src/pages/shoppingListDetails/components/AddToShoppingList.tsx index ffea9426..6fb18532 100644 --- a/apps/storefront/src/pages/shoppingListDetails/components/AddToShoppingList.tsx +++ b/apps/storefront/src/pages/shoppingListDetails/components/AddToShoppingList.tsx @@ -27,6 +27,7 @@ import { import { addProductToShoppingList, + addProductToBcShoppingList, } from '@/shared/service/b2b' import { @@ -35,6 +36,7 @@ import { interface AddToListProps { updateList: () => void + isB2BUser: boolean } export const AddToShoppingList = (props: AddToListProps) => { @@ -46,8 +48,11 @@ export const AddToShoppingList = (props: AddToListProps) => { const { updateList, + isB2BUser, } = props + const addItemsToShoppingList = isB2BUser ? addProductToShoppingList : addProductToBcShoppingList + const addToList = async (products: CustomFieldItems[]) => { const items = products.map((product) => ({ optionList: product.newSelectOptionList, @@ -56,7 +61,7 @@ export const AddToShoppingList = (props: AddToListProps) => { variantId: product.variantId, })) - const res: CustomFieldItems = await addProductToShoppingList({ + const res: CustomFieldItems = await addItemsToShoppingList({ shoppingListId: id, items, }) @@ -76,7 +81,7 @@ export const AddToShoppingList = (props: AddToListProps) => { variantId: parseInt(product.variantId, 10) || 0, })) - const res: CustomFieldItems = await addProductToShoppingList({ + const res: CustomFieldItems = await addItemsToShoppingList({ shoppingListId: id, items, }) @@ -99,6 +104,7 @@ export const AddToShoppingList = (props: AddToListProps) => { diff --git a/apps/storefront/src/pages/shoppingListDetails/components/ChooseOptionsDialog.tsx b/apps/storefront/src/pages/shoppingListDetails/components/ChooseOptionsDialog.tsx index d1c56875..5061bbba 100644 --- a/apps/storefront/src/pages/shoppingListDetails/components/ChooseOptionsDialog.tsx +++ b/apps/storefront/src/pages/shoppingListDetails/components/ChooseOptionsDialog.tsx @@ -44,6 +44,7 @@ import { import { searchB2BProducts, + searchBcProducts, } from '@/shared/service/b2b' import { @@ -98,6 +99,7 @@ interface ChooseOptionsDialogProps { isLoading: boolean, setIsLoading: Dispatch>, addButtonText?: string, + isB2BUser: boolean, } export const ChooseOptionsDialog = (props: ChooseOptionsDialogProps) => { @@ -111,6 +113,7 @@ export const ChooseOptionsDialog = (props: ChooseOptionsDialogProps) => { isLoading, setIsLoading, addButtonText = 'Add To List', + isB2BUser, } = props const [quantity, setQuantity] = useState(1) @@ -139,9 +142,11 @@ export const ChooseOptionsDialog = (props: ChooseOptionsDialogProps) => { }, []) if (productIds.length > 0) { + const getProducts = isB2BUser ? searchB2BProducts : searchBcProducts + const { productsSearch, - } : CustomFieldItems = await searchB2BProducts({ + } : CustomFieldItems = await getProducts({ productIds, }) diff --git a/apps/storefront/src/pages/shoppingListDetails/components/QuickAdd.tsx b/apps/storefront/src/pages/shoppingListDetails/components/QuickAdd.tsx index f662d5e4..8820e206 100644 --- a/apps/storefront/src/pages/shoppingListDetails/components/QuickAdd.tsx +++ b/apps/storefront/src/pages/shoppingListDetails/components/QuickAdd.tsx @@ -2,6 +2,7 @@ import { useState, useEffect, KeyboardEventHandler, + useContext, } from 'react' import { @@ -28,6 +29,10 @@ import { snackbar, } from '@/utils' +import { + GlobaledContext, +} from '@/shared/global' + import { getQuickAddRowFields, } from '../shared/config' @@ -39,6 +44,7 @@ import { import { getB2BVariantInfoBySkus, + getBcVariantInfoBySkus, } from '../../../shared/service/b2b' interface AddToListContentProps { @@ -56,6 +62,12 @@ export const QuickAdd = (props: AddToListContentProps) => { buttonText = 'Add product to list', } = props + const { + state: { + isB2BUser, + }, + } = useContext(GlobaledContext) + const b3Lang = useB3Lang() const [rows, setRows] = useState(level) @@ -235,10 +247,12 @@ export const QuickAdd = (props: AddToListContentProps) => { } const getVariantList = async (skus: string[]) => { + const getVariantInfoBySku = isB2BUser ? getB2BVariantInfoBySkus : getBcVariantInfoBySkus + try { const { variantSku: variantInfoList, - }: CustomFieldItems = await getB2BVariantInfoBySkus({ + }: CustomFieldItems = await getVariantInfoBySku({ skus, }, true) diff --git a/apps/storefront/src/pages/shoppingListDetails/components/SearchProduct.tsx b/apps/storefront/src/pages/shoppingListDetails/components/SearchProduct.tsx index 86ba42c7..6a1c0b2f 100644 --- a/apps/storefront/src/pages/shoppingListDetails/components/SearchProduct.tsx +++ b/apps/storefront/src/pages/shoppingListDetails/components/SearchProduct.tsx @@ -32,6 +32,7 @@ import { import { searchB2BProducts, + searchBcProducts, } from '@/shared/service/b2b' import { @@ -43,6 +44,7 @@ interface SearchProductProps { addToList: (products: CustomFieldItems[]) => CustomFieldItems, searchDialogTitle?: string, addButtonText?: string, + isB2BUser: boolean, } export const SearchProduct = ({ @@ -50,6 +52,7 @@ export const SearchProduct = ({ addToList, searchDialogTitle, addButtonText, + isB2BUser, }: SearchProductProps) => { const [isLoading, setIsLoading] = useState(false) @@ -68,12 +71,13 @@ export const SearchProduct = ({ if (!searchText || isLoading) { return } + const getProducts = isB2BUser ? searchB2BProducts : searchBcProducts setIsLoading(true) try { const { productsSearch, - } : CustomFieldItems = await searchB2BProducts({ + } : CustomFieldItems = await getProducts({ search: searchText, }) @@ -232,6 +236,7 @@ export const SearchProduct = ({ onCancel={handleChooseOptionsDialogCancel} onConfirm={handleChooseOptionsDialogConfirm} addButtonText={addButtonText} + isB2BUser={isB2BUser} /> diff --git a/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailFooter.tsx b/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailFooter.tsx index 0706942f..7b1ba98f 100644 --- a/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailFooter.tsx +++ b/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailFooter.tsx @@ -28,6 +28,7 @@ import { import { getB2BVariantInfoBySkus, + getBcVariantInfoBySkus, } from '@/shared/service/b2b/graphql/product' import { @@ -68,6 +69,7 @@ interface ShoppingDetailFooterProps { setDeleteOpen: (val: boolean) => void, setValidateFailureProducts: (arr: ProductsProps[]) => void, setValidateSuccessProducts: (arr: ProductsProps[]) => void, + isB2BUser: boolean, } const ShoppingDetailFooter = (props: ShoppingDetailFooterProps) => { @@ -96,6 +98,7 @@ const ShoppingDetailFooter = (props: ShoppingDetailFooterProps) => { setDeleteOpen, setValidateFailureProducts, setValidateSuccessProducts, + isB2BUser, } = props const verifyInventory = (inventoryInfos: ProductsProps[]) => { @@ -159,7 +162,9 @@ const ShoppingDetailFooter = (props: ShoppingDetailFooterProps) => { return } - const getInventoryInfos = await getB2BVariantInfoBySkus({ + const getVariantInfoBySku = isB2BUser ? getB2BVariantInfoBySkus : getBcVariantInfoBySkus + + const getInventoryInfos = await getVariantInfoBySku({ skus, }) diff --git a/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailHeader.tsx b/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailHeader.tsx index 66ea088e..1b61b8b3 100644 --- a/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailHeader.tsx +++ b/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailHeader.tsx @@ -30,6 +30,7 @@ interface ShoppingDetailHeaderProps { customerInfo: any, goToShoppingLists: () => void, handleUpdateShoppingList: (status: number) => void, + isB2BUser: boolean, } const ShoppingDetailHeader = (props: ShoppingDetailHeaderProps) => { @@ -41,10 +42,13 @@ const ShoppingDetailHeader = (props: ShoppingDetailHeaderProps) => { customerInfo, handleUpdateShoppingList, goToShoppingLists, + isB2BUser, } = props const isDisabledBtn = shoppingListInfo?.products?.edges.length === 0 + const currentSLCreateRole = shoppingListInfo?.customerInfo?.role + const gridOptions = (xs: number) => (isMobile ? {} : { xs, }) @@ -111,17 +115,21 @@ const ShoppingDetailHeader = (props: ShoppingDetailHeaderProps) => { > {`${shoppingListInfo?.name || ''}`} - - { - shoppingListInfo && ( - - ) - } - + { + isB2BUser && +currentSLCreateRole === 2 && ( + + { + shoppingListInfo && ( + + ) + } + + ) + } { > {shoppingListInfo?.description} - - - Created by: - - {`${customerInfo?.firstName || ''} ${customerInfo?.lastName || ''}`} - + { + isB2BUser && ( + + + Created by: + + {`${customerInfo?.firstName || ''} ${customerInfo?.lastName || ''}`} + + ) + } diff --git a/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailTable.tsx b/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailTable.tsx index 872e498f..5dfed402 100644 --- a/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailTable.tsx +++ b/apps/storefront/src/pages/shoppingListDetails/components/ShoppingDetailTable.tsx @@ -29,6 +29,7 @@ import { import { updateB2BShoppingListsItem, + updateBcShoppingListsItem, } from '@/shared/service/b2b' import { @@ -100,6 +101,7 @@ interface ShoppingDetailTableProps { isJuniorApprove: boolean, setDeleteItemId: (itemId: number | string) => void, setDeleteOpen: (open: boolean) => void, + isB2BUser: boolean, } interface SearchProps { @@ -167,6 +169,7 @@ const ShoppingDetailTable = (props: ShoppingDetailTableProps, ref: Ref) setDeleteItemId, setDeleteOpen, isJuniorApprove, + isB2BUser, } = props const paginationTableRef = useRef(null) @@ -240,6 +243,7 @@ const ShoppingDetailTable = (props: ShoppingDetailTableProps, ref: Ref) const handleChooseOptionsDialogConfirm = async (products: CustomFieldItems[]) => { setIsRequestLoading(true) + const updateShoppingListItem = isB2BUser ? updateB2BShoppingListsItem : updateBcShoppingListsItem try { const data = { itemId: editProductItemId, @@ -251,7 +255,7 @@ const ShoppingDetailTable = (props: ShoppingDetailTableProps, ref: Ref) }, } - await updateB2BShoppingListsItem(data) + await updateShoppingListItem(data) setSelectedOptionsOpen(false) setEditProductItemId('') snackbar.success('Product updated successfully') @@ -301,7 +305,9 @@ const ShoppingDetailTable = (props: ShoppingDetailTableProps, ref: Ref) itemData, } - await updateB2BShoppingListsItem(data) + const updateShoppingListItem = isB2BUser ? updateB2BShoppingListsItem : updateBcShoppingListsItem + + await updateShoppingListItem(data) snackbar.success('Product quantity updated successfully') setQtyNotChangeFlag(true) initSearch() @@ -627,6 +633,7 @@ const ShoppingDetailTable = (props: ShoppingDetailTableProps, ref: Ref) onConfirm={handleChooseOptionsDialogConfirm} currency={currencyToken} isEdit + isB2BUser={isB2BUser} /> diff --git a/apps/storefront/src/pages/shoppingLists/AddEditShoppingLists.tsx b/apps/storefront/src/pages/shoppingLists/AddEditShoppingLists.tsx index 1c9f0845..47b81867 100644 --- a/apps/storefront/src/pages/shoppingLists/AddEditShoppingLists.tsx +++ b/apps/storefront/src/pages/shoppingLists/AddEditShoppingLists.tsx @@ -12,8 +12,11 @@ import { import { updateB2BShoppingList, + updateBcShoppingList, createB2BShoppingList, + createBcShoppingList, duplicateB2BShoppingList, + duplicateBcShoppingList, } from '@/shared/service/b2b' import { B3CustomForm, @@ -33,11 +36,15 @@ import { interface AddEditUserProps { renderList: () => void role: number | string + isB2BUser: boolean + channelId: number } const AddEditShoppingLists = ({ renderList, role, + isB2BUser, + channelId, }: AddEditUserProps, ref: Ref | undefined) => { const [open, setOpen] = useState(false) const [type, setType] = useState('') @@ -91,22 +98,32 @@ const AddEditShoppingLists = ({ ...data, } - let fn = createB2BShoppingList + let fn = isB2BUser ? createB2BShoppingList : createBcShoppingList let successTip = 'add shoppingLists successfully' if (type === 'edit') { - fn = updateB2BShoppingList + if (isB2BUser) { + fn = updateB2BShoppingList + params.status = editData?.status + } else { + fn = updateBcShoppingList + params.channelId = channelId + } + params.id = editData?.id || 0 - params.status = editData?.status successTip = 'update shoppingLists successfully' } else if (type === 'dup') { - fn = duplicateB2BShoppingList + fn = isB2BUser ? duplicateB2BShoppingList : duplicateBcShoppingList params.sampleShoppingListId = editData?.id || 0 successTip = 'duplicate shoppingLists successfully' // params.status = +role === 2 ? 30 : editData?.status } else if (type === 'add') { - params.status = +role === 2 ? 30 : 0 + if (isB2BUser) { + params.status = +role === 2 ? 30 : 0 + } else { + params.channelId = channelId + } } await fn(params) diff --git a/apps/storefront/src/pages/shoppingLists/ShoppingLists.tsx b/apps/storefront/src/pages/shoppingLists/ShoppingLists.tsx index 1bee0e22..ae8060eb 100644 --- a/apps/storefront/src/pages/shoppingLists/ShoppingLists.tsx +++ b/apps/storefront/src/pages/shoppingLists/ShoppingLists.tsx @@ -13,7 +13,9 @@ import { import { getB2BShoppingList, + getBcShoppingList, deleteB2BShoppingList, + deleteBcShoppingList, } from '@/shared/service/b2b' import { @@ -63,6 +65,8 @@ const shoppingLists = () => { const { state: { role, + isB2BUser, + currentChannelId, }, } = useContext(GlobaledContext) @@ -85,6 +89,7 @@ const shoppingLists = () => { search: '', createdBy: '', status: statusPermissions, + isDefault: true, } const [filterSearch, setFilterSearch] = useState(initSearch) @@ -105,6 +110,7 @@ const shoppingLists = () => { ...initSearch, search: value, } + setFilterSearch(search) } } @@ -113,22 +119,33 @@ const shoppingLists = () => { const { status, } = data + const getNewStatus = (status === '' || status === 99) ? statusPermissions : status const search = { ...initSearch, createdBy: data.createdBy, status: getNewStatus, + isDefault: status === '', } setFilterSearch(search) } const fetchList = async (params: ShoppingListSearch) => { + const newParams = isB2BUser ? params : { + offset: params.offset, + first: params.first, + search: params.search, + channelId: currentChannelId, + } + const getShoppingLists = isB2BUser ? getB2BShoppingList : getBcShoppingList + const infoKey = isB2BUser ? 'shoppingLists' : 'customerShoppingLists' + const { - shoppingLists: { + [infoKey]: { edges, totalCount, }, - } = await getB2BShoppingList(params) + } = await getShoppingLists(newParams) return { edges, totalCount, @@ -162,7 +179,9 @@ const shoppingLists = () => { setIsRequestLoading(true) handleCancelClick() const id: number = deleteItem?.id || 0 - await deleteB2BShoppingList(id) + + const deleteShoppingList = isB2BUser ? deleteB2BShoppingList : deleteBcShoppingList + await deleteShoppingList(id) snackbar.success('delete shoppingList successfully') initSearchList() } finally { @@ -182,6 +201,7 @@ const shoppingLists = () => { }} > { onEdit={handleEdit} onDelete={handleDelete} onCopy={handleCopy} + isB2BUser={isB2BUser} /> )} /> @@ -212,6 +233,8 @@ const shoppingLists = () => { role={role} renderList={initSearchList} ref={addEditShoppingListsRef} + isB2BUser={isB2BUser} + channelId={currentChannelId} /> void isPermissions: boolean role: number | string + isB2BUser: boolean } const Flex = styled('div')(() => ({ @@ -61,8 +62,11 @@ const ShoppingListsCard = (props: OrderItemCardProps) => { onCopy, isPermissions, role, + isB2BUser, } = props + const currentSLCreateRole = shoppingList?.customerInfo?.role + const getEditPermissions = (status: number) => { if (+role === 2) { if (status === 30 || status === 0) return false @@ -112,13 +116,17 @@ const ShoppingListsCard = (props: OrderItemCardProps) => { pb: '20px', }} > - - - + { + isB2BUser && +currentSLCreateRole === 2 && ( + + + + ) + } { } - - - Created by: - - {shoppingList.customerInfo.firstName} - {' '} - {shoppingList.customerInfo.lastName} - + { + isB2BUser && ( + + + Created by: + + {shoppingList.customerInfo.firstName} + {' '} + {shoppingList.customerInfo.lastName} + + ) + } Products: diff --git a/apps/storefront/src/pages/shoppingLists/config.ts b/apps/storefront/src/pages/shoppingLists/config.ts index eef5154f..9919e731 100644 --- a/apps/storefront/src/pages/shoppingLists/config.ts +++ b/apps/storefront/src/pages/shoppingLists/config.ts @@ -16,6 +16,7 @@ interface ShoppingListsItemsCustomerInfoProps { lastName: string userId: number email: string + role: string } export interface ShoppingListsItemsProps { @@ -29,6 +30,7 @@ export interface ShoppingListsItemsProps { } updatedAt: string | number, sampleShoppingListId?: number | string + channelId: number } export interface GetFilterMoreListProps { diff --git a/apps/storefront/src/shared/routes/routes.ts b/apps/storefront/src/shared/routes/routes.ts index 6e8a62e2..1f2f3b63 100644 --- a/apps/storefront/src/shared/routes/routes.ts +++ b/apps/storefront/src/shared/routes/routes.ts @@ -128,7 +128,7 @@ const routes: RouteItem[] = [ wsKey: 'router-shopping-list', isMenuItem: false, component: ShoppingListDetails, - permissions: [0, 1, 2, 3], + permissions: [0, 1, 2, 3, 99], isTokenLogin: true, }, { @@ -147,7 +147,7 @@ const routes: RouteItem[] = [ isMenuItem: true, component: ShippingLists, configKey: 'shoppingLists', - permissions: [0, 1, 2, 3], + permissions: [0, 1, 2, 3, 99], isTokenLogin: true, }, { diff --git a/apps/storefront/src/shared/service/b2b/graphql/product.ts b/apps/storefront/src/shared/service/b2b/graphql/product.ts index 71054991..bd666651 100644 --- a/apps/storefront/src/shared/service/b2b/graphql/product.ts +++ b/apps/storefront/src/shared/service/b2b/graphql/product.ts @@ -84,3 +84,11 @@ export const getB2BVariantSkuByProductId = (productId: string): CustomFieldItems export const searchB2BProducts = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlB2B({ query: searchProducts(data), }) + +export const searchBcProducts = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlProxyBC({ + query: searchProducts(data), +}) + +export const getBcVariantInfoBySkus = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlProxyBC({ + query: getVariantInfoBySkus(data), +}) diff --git a/apps/storefront/src/shared/service/b2b/graphql/shoppingList.ts b/apps/storefront/src/shared/service/b2b/graphql/shoppingList.ts index 6952cf03..c516d241 100644 --- a/apps/storefront/src/shared/service/b2b/graphql/shoppingList.ts +++ b/apps/storefront/src/shared/service/b2b/graphql/shoppingList.ts @@ -23,6 +23,7 @@ const getShoppingList = ({ status = '', createdBy = '', search = '', + isDefault = true, }) => `{ shoppingLists ( offset: ${offset} @@ -30,6 +31,7 @@ const getShoppingList = ({ search: "${search}" createdBy: "${createdBy}" ${getStatus(status)} + isDefault: ${isDefault} ){ totalCount, pageInfo{ @@ -47,6 +49,7 @@ const getShoppingList = ({ lastName, userId, email, + role, }, updatedAt, isOwner, @@ -137,6 +140,7 @@ const getShoppingListDetails = (data: CustomFieldItems) => `{ lastName, userId, email, + role, }, isOwner, grandTotal, @@ -212,6 +216,175 @@ const deleteShoppingListItem = (data: CustomFieldItems) => `mutation { } }` +const getCustomerShoppingLists = ({ + offset = 0, + first = 50, + search = '', + channelId = 1, +}) => `{ + customerShoppingLists ( + offset: ${offset} + first: ${first} + search: "${search}" + channelId: ${channelId} + ){ + totalCount, + pageInfo{ + hasNextPage, + hasPreviousPage, + }, + edges{ + node{ + id, + name, + description, + updatedAt, + products { + totalCount, + } + } + } + } +}` + +const createOrUpdateCustomerShoppingList = (fn: string, data: CustomFieldItems) => `mutation { + ${fn}( + ${!data?.id ? '' : `id: ${data.id}`} + ${!data?.sampleShoppingListId ? '' : `sampleShoppingListId: ${data.sampleShoppingListId}`} + shoppingListData: { + name: "${data.name}", + description: "${data.description}", + ${!data?.channelId ? '' : `channelId: ${data.channelId}`} + }) { + shoppingList { + id, + name, + description, + grandTotal, + totalDiscount, + totalTax, + isShowGrandTotal, + } + } +}` + +const deleteCustomerShoppingList = (id: number) => `mutation{ + customerShoppingListsDelete (id: ${id}) { + message + } +}` + +const getCustomerShoppingListDetails = (data: CustomFieldItems) => `{ + customerShoppingList ( + id: ${data.id} + ) { + id, + createdAt, + updatedAt, + name, + description, + reason, + grandTotal, + totalDiscount, + totalTax, + isShowGrandTotal, + channelId, + channelName, + products ( + offset: ${data.offset || 0} + first: ${data.first || 100}, + search: "${data.search || ''}", + ) { + totalCount, + edges { + node { + id, + createdAt, + updatedAt, + productId, + variantId, + quantity, + productName, + optionList, + itemId, + baseSku, + variantSku, + basePrice, + discount, + tax, + enteredInclusive, + productUrl, + primaryImage, + } + } + } + } +}` + +const addItemsToBcShoppingList = (data: CustomFieldItems) => `mutation { + customerShoppingListsItemsCreate ( + shoppingListId: ${data.shoppingListId}, + items: ${convertArrayToGraphql(data.items || [])} + ) { + shoppingListsItems { + id, + createdAt, + updatedAt, + productId, + variantId, + quantity, + productName, + optionList, + itemId, + baseSku, + variantSku, + basePrice, + discount, + tax, + enteredInclusive, + productUrl, + primaryImage, + } + } +}` + +const updateCustomerShoppingListsItem = (data: CustomFieldItems) => `mutation { + customerShoppingListsItemsUpdate ( + itemId: ${data.itemId} + shoppingListId: ${data.shoppingListId} + itemData: ${convertObjectToGraphql(data.itemData || [])} + ) { + shoppingListsItem { + id, + createdAt, + updatedAt, + productId, + variantId, + quantity, + productName, + optionList, + itemId, + baseSku, + variantSku, + basePrice, + discount, + tax, + enteredInclusive, + productUrl, + primaryImage, + } + } +}` + +const deleteCustomerShoppingListItem = (data: CustomFieldItems) => `mutation { + customerShoppingListsItemsDelete ( + itemId: ${data.itemId}, + shoppingListId: ${data.shoppingListId}, + ) { + message, + } +}` + export const getB2BShoppingList = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlB2B({ query: getShoppingList(data), }) @@ -247,3 +420,39 @@ export const updateB2BShoppingListsItem = (data: CustomFieldItems = {}): CustomF export const deleteB2BShoppingListItem = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlB2B({ query: deleteShoppingListItem(data), }) + +export const getBcShoppingList = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlProxyBC({ + query: getCustomerShoppingLists(data), +}) + +export const createBcShoppingList = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlProxyBC({ + query: createOrUpdateCustomerShoppingList('customerShoppingListsCreate', data), +}) + +export const updateBcShoppingList = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlProxyBC({ + query: createOrUpdateCustomerShoppingList('customerShoppingListsUpdate', data), +}) + +export const duplicateBcShoppingList = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlProxyBC({ + query: createOrUpdateCustomerShoppingList('customerShoppingListsDuplicate', data), +}) + +export const deleteBcShoppingList = (id: number): CustomFieldItems => B3Request.graphqlProxyBC({ + query: deleteCustomerShoppingList(id), +}) + +export const getBcShoppingListDetails = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlProxyBC({ + query: getCustomerShoppingListDetails(data), +}) + +export const addProductToBcShoppingList = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlProxyBC({ + query: addItemsToBcShoppingList(data), +}) + +export const updateBcShoppingListsItem = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlProxyBC({ + query: updateCustomerShoppingListsItem(data), +}) + +export const deleteBcShoppingListItem = (data: CustomFieldItems = {}): CustomFieldItems => B3Request.graphqlProxyBC({ + query: deleteCustomerShoppingListItem(data), +}) diff --git a/apps/storefront/src/shared/service/b2b/index.ts b/apps/storefront/src/shared/service/b2b/index.ts index f32a160c..a2b4284c 100644 --- a/apps/storefront/src/shared/service/b2b/index.ts +++ b/apps/storefront/src/shared/service/b2b/index.ts @@ -83,11 +83,22 @@ import { addProductToShoppingList, updateB2BShoppingListsItem, deleteB2BShoppingListItem, + getBcShoppingList, + createBcShoppingList, + updateBcShoppingList, + duplicateBcShoppingList, + deleteBcShoppingList, + getBcShoppingListDetails, + addProductToBcShoppingList, + updateBcShoppingListsItem, + deleteBcShoppingListItem, } from './graphql/shoppingList' import { getB2BVariantInfoBySkus, + getBcVariantInfoBySkus, searchB2BProducts, + searchBcProducts, } from './graphql/product' import { @@ -198,4 +209,15 @@ export { updateBCQuote, quoteDetailAttachFileCreate, quoteDetailAttachFileDelete, + getBcShoppingList, + createBcShoppingList, + updateBcShoppingList, + duplicateBcShoppingList, + deleteBcShoppingList, + getBcShoppingListDetails, + addProductToBcShoppingList, + updateBcShoppingListsItem, + deleteBcShoppingListItem, + searchBcProducts, + getBcVariantInfoBySkus, }