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AC9CwD,EAAe,KAJjB,CACF,CAWA,GAAI7L,MAAAA,EAAAA,KAAAA,EAAAA,EAAwB0B,YAAY,CAGtC,OAFA1B,EAAuB0B,YAAY,CAACc,MAAM,CAACa,EAAE,CAAC,SAAU6K,GACxDlO,EAAuB0B,YAAY,CAACc,MAAM,CAACa,EAAE,CAAC,SAAU4E,GACjD,KACLjI,EAAuB0B,YAAY,CAACc,MAAM,CAACc,cAAc,CAAC,SAAU4K,GACpElO,EAAuB0B,YAAY,CAACc,MAAM,CAACc,cAAc,CAAC,SAAU2E,EACtE,CAEJ,EAAG,CAACjI,EAAuB,EAsEpB,GAAA0D,EAAAM,GAAA,EAACqH,EAAad,QAAQ,EAACC,MAThB,CACZvD,YAAAA,EACA0E,eAAAA,EACA/L,iBAAAA,EACAsH,oBAAAA,EACA0E,iBAAAA,EACA9L,YAAAA,EACAD,eAAAA,CACF,EAC4CuE,sBAAoB,UAAUN,wBAAsB,uBAAuBC,0BAAwB,4BAC1IkC,EAAMwE,QAAQ,EAErB,EACa1K,EAAkB,IAAMsO,CAAAA,EAAAA,EAAAA,UAAAA,EAAWhD","sources":["webpack://_N_E/?39d2","webpack://_N_E/./src/app/cart/Cart.tsx","webpack://_N_E/./src/app/common/components/Button.tsx","webpack://_N_E/./src/app/common/components/ErrorMessage.tsx","webpack://_N_E/./src/app/common/components/SecondaryButton.tsx","webpack://_N_E/./src/app/components/nav/Navigation.tsx","webpack://_N_E/./src/wagmi.ts","webpack://_N_E/./src/context/MerchantContext.tsx","webpack://_N_E/./src/app/providers.tsx","webpack://_N_E/./src/context/StoreContext.tsx","webpack://_N_E/./src/app/globals.css","webpack://_N_E/"],"sourcesContent":["import(/* webpackMode: \"eager\" */ \"/Users/cryptix/Documents/MassLbs/Tennessine/packages/frontend/src/app/components/nav/Navigation.tsx\");\nimport(/* webpackMode: \"eager\" */ \"/Users/cryptix/Documents/MassLbs/Tennessine/packages/frontend/src/app/globals.css\");\nimport(/* webpackMode: \"eager\" */ \"/Users/cryptix/Documents/MassLbs/Tennessine/packages/frontend/src/app/providers.tsx\")","// SPDX-FileCopyrightText: 2024 Mass Labs\n//\n// SPDX-License-Identifier: GPL-3.0-or-later\n\n\"use client\";\n\nimport React, { useEffect, useState } from \"react\";\nimport { formatUnitsFromString, logger } from \"@massmarket/utils\";\nimport { ListingId, Order, OrderEventTypes, OrderId } from \"@/types\";\nimport { useStoreContext } from \"@/context/StoreContext\";\nimport { useUserContext } from \"@/context/UserContext\";\nimport Button from \"@/app/common/components/Button\";\nimport SecondaryButton from \"@/app/common/components/SecondaryButton\";\nimport ErrorMessage from \"@/app/common/components/ErrorMessage\";\nconst namespace = \"frontend:Cart\";\nconst debug = logger(namespace);\nconst logerr = logger(namespace, \"error\");\nfunction Cart({\n onCheckout\n}: {\n onCheckout?: (orderId: OrderId) => Promise;\n}) {\n const {\n getBaseTokenInfo,\n getOpenOrderId,\n openOrderId\n } = useStoreContext();\n const {\n clientWithStateManager\n } = useUserContext();\n const [cartItemsMap, setCartMap] = useState(new Map());\n const [orderId, setOrderId] = useState(null);\n const [baseDecimal, setBaseDecimal] = useState(null);\n const [baseSymbol, setBaseSymbol] = useState(null);\n const [errorMsg, setErrorMsg] = useState(null);\n useEffect(() => {\n getBaseTokenInfo().then((res: [string, number]) => {\n res && setBaseDecimal(res[1]);\n res && setBaseSymbol(res[0]);\n });\n }, []);\n useEffect(() => {\n function onChangeItems(res: [OrderEventTypes, Order]) {\n if (res[0] === OrderEventTypes.CHANGE_ITEMS) {\n getCartItemDetails(res[1]).then(itemDetails => {\n setCartMap(itemDetails);\n });\n }\n }\n clientWithStateManager.stateManager.orders.on(\"update\", onChangeItems);\n return () => {\n clientWithStateManager.stateManager.orders.removeListener(\"update\", onChangeItems);\n };\n }, []);\n useEffect(() => {\n // TODO: i think these functions maybe should be useState-like variables\n getOpenOrderId().then((oId: OrderId | null) => {\n if (oId) {\n debug(`Open order ID: ${oId}`);\n setOrderId(oId);\n clientWithStateManager!.stateManager!.orders.get(oId).then(async o => {\n const itemDetails = await getCartItemDetails(o);\n setCartMap(itemDetails);\n });\n }\n });\n }, []);\n useEffect(() => {\n // If order ID changes in storeContext from event listeners change the order ID here.\n setOrderId(openOrderId);\n }, []);\n async function getCartItemDetails(order: Order) {\n const ci = order.items;\n const cartObjects = new Map();\n // Get price and metadata for all the selected items in the order.\n const itemIds = Object.keys(ci);\n await Promise.all(itemIds.map(async id => {\n const item = await clientWithStateManager.stateManager.listings.get(id as ListingId);\n cartObjects.set(id, {\n ...item,\n selectedQty: ci[id as ListingId]\n });\n }));\n return cartObjects;\n }\n async function handleCheckout(orderId: OrderId) {\n try {\n await onCheckout!(orderId);\n } catch (error) {\n if (error instanceof Error && error.message === \"not enough items in stock for order\" || error.message == \"not enough stock\" || error.message == \"not in stock\") {\n setErrorMsg(\"Not enough stock. Cart cleared.\");\n await clearCart();\n return;\n }\n logerr(\"Error during checkout\", error);\n }\n }\n async function clearCart() {\n try {\n const values = Array.from(cartItemsMap.values());\n const map = values.map(item => {\n // We are getting the quantity to remove from the order for every item in the cart.\n return {\n listingId: item.id,\n quantity: item.selectedQty\n };\n });\n await clientWithStateManager.stateManager.orders.removeItems(orderId!, map);\n setCartMap(new Map());\n debug(\"cart cleared\");\n } catch (error) {\n logerr(\"Error clearing cart\", error);\n }\n }\n async function addQuantity(id: ListingId) {\n try {\n await clientWithStateManager.stateManager.orders.addItems(orderId!, [{\n listingId: id,\n quantity: 1\n }]);\n } catch (error) {\n logerr(`Error:addQuantity ${error}`);\n }\n }\n async function removeQuantity(id: ListingId) {\n try {\n await clientWithStateManager.stateManager.orders.removeItems(orderId!, [{\n listingId: id,\n quantity: 1\n }]);\n } catch (error) {\n logerr(`Error:removeQuantity ${error}`);\n }\n }\n async function removeItem(id: ListingId, selectedQty: number) {\n try {\n await clientWithStateManager.stateManager.orders.removeItems(orderId!, [{\n listingId: id,\n quantity: selectedQty\n }]);\n } catch (error) {\n logerr(`Error:removeItem ${error}`);\n }\n }\n function calculateTotal() {\n const values = cartItemsMap.values();\n let total = 0;\n Array.from(values).forEach(item => {\n total += baseDecimal ? formatUnitsFromString(item.price, baseDecimal) * item.selectedQty : 0;\n });\n return total;\n }\n const icon = baseSymbol === \"ETH\" ? \"/icons/eth-coin.svg\" : \"/icons/usdc-coin.png\";\n function renderItems() {\n if (!orderId || !cartItemsMap.size) return

No items in cart

;\n const values = cartItemsMap.values();\n return Array.from(values).map(item => {\n const price = baseDecimal ? formatUnitsFromString(item.price, baseDecimal) * item.selectedQty : 0;\n if (!item.selectedQty) return null;\n return
\n
\n \"product-thumb\"\n
\n
\n
\n

\n {item.metadata.title}\n

\n \n
\n\n
\n
\n \n

{item.selectedQty}

\n \n
\n
\n \"coin\"\n

{price}

\n

{baseSymbol}

\n
\n
\n
\n
;\n });\n }\n return
\n {\n setErrorMsg(null);\n }} data-sentry-element=\"ErrorMessage\" data-sentry-source-file=\"Cart.tsx\" />\n {renderItems()}\n
\n

Total Price:

\n
\n \"coin\"\n

{calculateTotal()}

\n
\n
\n
\n \n \n Clear basket\n \n
\n
;\n}\nexport default Cart;","// SPDX-FileCopyrightText: 2024 Mass Labs\n//\n// SPDX-License-Identifier: GPL-3.0-or-later\n\n\"use client\";\n\nimport React from \"react\";\nexport interface ButtonProps extends React.ButtonHTMLAttributes {\n custom?: string;\n}\nconst Button = React.forwardRef(({\n ...props\n}, ref) => {\n //fixme: make sure button ui is clicked, not just fire onclick fn\n return \n ;\n};\nexport default ErrorMessage;","// SPDX-FileCopyrightText: 2024 Mass Labs\n//\n// SPDX-License-Identifier: GPL-3.0-or-later\n\n\"use client\";\n\nimport React from \"react\";\nexport interface ButtonProps extends React.ButtonHTMLAttributes {\n custom?: string;\n}\nconst SecondaryButton = React.forwardRef(({\n ...props\n}, ref) => {\n return ;\n }\n return
setMenuOpen(false)}>\n
\n \"menu-item\"\n \n

{opt.title}

\n \n \"chevron-right\"\n
\n
;\n });\n }\n return
\n
\n
\n {shopDetails.profilePictureUrl ?
\n \"profile-avatar\"\n
: \"mass-labs-logo\"}\n\n

{shopDetails.name}

\n
\n
\n \n \n
\n
\n {menuOpen ?
\n \n
\n {renderMenuItems()}\n
\n
: null}\n {basketOpen ?
\n \n
\n \n
\n
: null}\n
;\n}\nexport default Navigation;","import { getDefaultConfig } from \"@rainbow-me/rainbowkit\";\nimport {\n hardhat,\n mainnet,\n optimism,\n optimismSepolia,\n sepolia,\n} from \"wagmi/chains\";\nimport { http } from \"wagmi\";\n\nexport const config = getDefaultConfig({\n appName: \"Mass Labs\",\n projectId: \"6c432edcd930e0fa2c87a8d940ae5b91\",\n chains: [mainnet, optimism, sepolia, hardhat, optimismSepolia],\n ssr: false,\n transports: {\n [mainnet.id]: http(),\n [sepolia.id]: http(),\n [hardhat.id]: http(),\n [optimism.id]: http(),\n [optimismSepolia.id]: http(),\n },\n});\n","// SPDX-FileCopyrightText: 2024 Mass Labs\n//\n// SPDX-License-Identifier: GPL-3.0-or-later\n\nimport React, { Dispatch, SetStateAction } from \"react\";\nimport { createContext, useContext, useState } from \"react\";\nimport { ShopId } from \"@/types\";\nexport type IMerchantContext = {\n storeIds: Map | null;\n setStoreIds: Dispatch | null>>;\n};\nexport const MerchantContext = createContext({\n storeIds: null,\n setStoreIds: () => {}\n});\ntype Props = {\n children: React.ReactNode;\n};\nexport const MerchantProvider = (props: Props) => {\n const [storeIds, setStoreIds] = useState | null>(null);\n return \n {props.children}\n ;\n};\nexport const useMerchantContext = () => useContext(MerchantContext);","// SPDX-FileCopyrightText: 2024 Mass Labs\n//\n// SPDX-License-Identifier: GPL-3.0-or-later\n\n\"use client\";\n\nimport React, { type ReactNode, useState } from \"react\";\nimport { RainbowKitProvider } from \"@rainbow-me/rainbowkit\";\nimport \"@rainbow-me/rainbowkit/styles.css\";\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { WagmiProvider } from \"wagmi\";\nimport { config } from \"../wagmi\";\nimport { UserContextProvider } from \"../context/UserContext\";\nimport { StoreContextProvider } from \"../context/StoreContext\";\nimport { AuthProvider } from \"@/context/AuthContext\";\nimport { MerchantProvider } from \"@/context/MerchantContext\";\nexport function Providers(props: {\n children: ReactNode;\n}) {\n const [queryClient] = useState(() => new QueryClient());\n return \n \n \n \n \n \n {props.children}\n \n \n \n \n \n ;\n}","// SPDX-FileCopyrightText: 2024 Mass Labs\n//\n// SPDX-License-Identifier: GPL-3.0-or-later\n\nimport React, { createContext, useContext, useEffect, useState } from \"react\";\nimport { useChains } from \"wagmi\";\nimport { Address } from \"viem\";\nimport { usePathname } from \"next/navigation\";\nimport * as abi from \"@massmarket/contracts\";\nimport { assert, logger } from \"@massmarket/utils\";\nimport { StoreContent } from \"@/context/types\";\nimport { useUserContext } from \"@/context/UserContext\";\nimport { createPublicClientForChain, getTokenInformation } from \"@/app/utils\";\nimport { ListingId, Order, OrderEventTypes, OrderState } from \"@/types\";\nconst namespace = \"frontend:StoreContext\";\nconst debug = logger(namespace);\nconst warn = logger(namespace, \"warn\");\nconst errlog = logger(namespace, \"error\");\nexport const StoreContext = createContext({});\nexport const StoreContextProvider = (props: React.HTMLAttributes) => {\n const chains = useChains();\n const {\n clientWithStateManager,\n shopPublicClient,\n shopId\n } = useUserContext();\n const pathname = usePathname();\n const [shopDetails, setShopDetails] = useState({\n name: \"\",\n profilePictureUrl: \"\"\n });\n const [committedOrderId, setCommittedOrderId] = useState(null);\n const [openOrderId, setOpenOrderId] = useState(null);\n useEffect(() => {\n // If there is a committed order outside of the checkout flow, cancel committed order.\n if (pathname !== \"/checkout/\" && committedOrderId) {\n cancelAndCreateOrder().then();\n }\n }, [pathname, clientWithStateManager?.stateManager]);\n useEffect(() => {\n if (committedOrderId) {\n globalThis.addEventListener(\"beforeunload\", cancelAndCreateOrder);\n }\n return () => {\n globalThis.removeEventListener(\"beforeunload\", cancelAndCreateOrder);\n };\n }, []);\n useEffect(() => {\n if (shopPublicClient && shopId) {\n (async () => {\n const uri = await shopPublicClient.readContract({\n address: abi.addresses.ShopReg as Address,\n abi: abi.ShopReg,\n functionName: \"tokenURI\",\n args: [BigInt(shopId)]\n });\n const url = uri as string;\n if (url.length) {\n const res = await fetch(url);\n const data = await res.json();\n setShopDetails({\n name: data.name,\n profilePictureUrl: data.image\n });\n }\n })();\n }\n }, [shopPublicClient, shopId]);\n useEffect(() => {\n function onOrderCreate(order: Order) {\n if (order.status === OrderState.STATE_OPEN) {\n setOpenOrderId(order.id);\n }\n }\n function onOrderUpdate(res: [OrderEventTypes, Order]) {\n const order = res[1];\n const type = res[0];\n switch (type) {\n case OrderEventTypes.CANCELLED:\n orderCancel(order);\n break;\n case OrderEventTypes.PAYMENT_TX:\n txHashDetected(order);\n break;\n }\n }\n function txHashDetected(order: Order) {\n if (order.status === OrderState.STATE_PAYMENT_TX) {\n setOpenOrderId(null);\n }\n }\n function orderCancel(order: Order) {\n if (order.status === OrderState.STATE_CANCELED) {\n setOpenOrderId(null);\n }\n }\n if (clientWithStateManager?.stateManager) {\n clientWithStateManager.stateManager.orders.on(\"create\", onOrderCreate);\n clientWithStateManager.stateManager.orders.on(\"update\", onOrderUpdate);\n return () => {\n clientWithStateManager.stateManager.orders.removeListener(\"create\", onOrderCreate);\n clientWithStateManager.stateManager.orders.removeListener(\"update\", onOrderUpdate);\n };\n }\n }, [clientWithStateManager]);\n async function cancelAndCreateOrder() {\n const sm = clientWithStateManager.stateManager;\n debug(`Cancelling order ID: ${committedOrderId}`);\n const [_type, cancelledOrder] = await sm.orders.cancel(committedOrderId);\n // Once order is cancelled, create a new order and add the same items.\n const newOrder = await sm.orders.create();\n debug(\"New order created\");\n const listingsToAdd = Object.entries(cancelledOrder.items).map(([listingId, quantity]) => {\n return {\n listingId: listingId as ListingId,\n quantity\n };\n });\n await sm.orders.addItems(newOrder.id, listingsToAdd);\n debug(\"Listings added to new order\");\n }\n async function getBaseTokenInfo() {\n assert(clientWithStateManager, \"clientWithStateManager not ready\");\n //Get base token decimal and symbol.\n const manifest = await clientWithStateManager.stateManager.manifest.get();\n const {\n chainId,\n address\n } = manifest.pricingCurrency;\n const chain = chains.find(chain => chainId === chain.id);\n if (!chain) {\n throw new Error(\"No chain found\");\n }\n const baseTokenPublicClient = createPublicClientForChain(chain);\n const res = await getTokenInformation(baseTokenPublicClient, address!);\n debug(`getBaseTokenInfo: name: ${res[0]} | decimals:${res[1]}`);\n return res;\n }\n async function getOpenOrderId() {\n if (openOrderId) {\n return openOrderId;\n }\n if (!clientWithStateManager) {\n warn(\"stateManager not ready\");\n return null;\n }\n try {\n // TODO: this still has the problem of faulting/blocking over a previous stuck order\n const res = await clientWithStateManager.stateManager.orders.getStatus(OrderState.STATE_OPEN);\n if (res.length > 1) {\n debug(\"Multiple open orders found\");\n } else if (!res.length) {\n debug(\"No open order found\");\n } else {\n setOpenOrderId(res[0]);\n return res[0];\n }\n } catch (error) {\n if (error.notFound) {\n debug(\"No open orders yet\");\n return null;\n }\n errlog(\"Error getting open order\", error);\n }\n }\n const value = {\n shopDetails,\n setShopDetails,\n getBaseTokenInfo,\n setCommittedOrderId,\n committedOrderId,\n openOrderId,\n getOpenOrderId\n };\n return \n {props.children}\n ;\n};\nexport const useStoreContext = () => useContext(StoreContext);","// extracted by mini-css-extract-plugin"],"names":["Promise","resolve","then","__webpack_require__","bind","t","namespace","debug","logger","logerr","__webpack_exports__","Z","param","onCheckout","getBaseTokenInfo","getOpenOrderId","openOrderId","useStoreContext","clientWithStateManager","useUserContext","cartItemsMap","setCartMap","useState","Map","orderId","setOrderId","baseDecimal","setBaseDecimal","baseSymbol","setBaseSymbol","errorMsg","setErrorMsg","getCartItemDetails","order","ci","items","cartObjects","itemIds","Object","keys","all","map","id","item","stateManager","listings","get","set","selectedQty","handleCheckout","error","Error","message","clearCart","values","from","listingId","quantity","orders","removeItems","addQuantity","addItems","concat","removeQuantity","removeItem","useEffect","res","onChangeItems","OrderEventTypes","CHANGE_ITEMS","itemDetails","on","removeListener","oId","o","icon","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsxs","div","className","data-sentry-component","data-sentry-source-file","jsx","ErrorMessage","errorMessage","onClose","data-sentry-element","size","Array","price","formatUnitsFromString","data-testid","img","src","metadata","images","width","height","alt","h3","title","button","onClick","p","h1","calculateTotal","total","forEach","Button","disabled","style","display","SecondaryButton","React","ref","props","custom","displayName","merchantMenu","href","errlog","menuOpen","setMenuOpen","basketOpen","setBasketOpen","cartLength","setLength","clientConnected","setIsConnected","isMerchantView","useClient","shopDetails","setCommittedOrderId","router","useRouter","disconnect","useDisconnect","customerMenu","createQueryString","onDisconnect","localStorage","clear","push","Status","Pending","commit","assert","onOrderUpdate","PAYMENT_TX","status","OrderState","STATE_PAYMENT_TX","length","qty","Number","section","profilePictureUrl","h2","name","Complete","span","menuItems","opt","i","Link","Cart","config","getDefaultConfig","appName","projectId","chains","mainnet","optimism","sepolia","hardhat","optimismSepolia","ssr","transports","http","MerchantContext","createContext","storeIds","setStoreIds","MerchantProvider","jsx_runtime","Provider","value","children","Providers","queryClient","QueryClient","WagmiProvider","QueryClientProvider","client","RainbowKitProvider","AuthProvider","UserContextProvider","StoreContextProvider","warn","StoreContext","useChains","shopPublicClient","shopId","pathname","usePathname","setShopDetails","committedOrderId","setOpenOrderId","cancelAndCreateOrder","sm","_type","cancelledOrder","cancel","newOrder","create","listingsToAdd","entries","chainId","address","manifest","pricingCurrency","chain","find","baseTokenPublicClient","createPublicClientForChain","getTokenInformation","getStatus","STATE_OPEN","notFound","globalThis","addEventListener","removeEventListener","uri","readContract","abi","ShopReg","functionName","args","BigInt","url","fetch","data","json","image","onOrderCreate","CANCELLED","STATE_CANCELED","useContext"],"sourceRoot":""}