Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kuza one #517

Open
wants to merge 57 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
258dc55
feat: adding sign in flow
Mar 26, 2024
89ba8b6
feat: initial setup for mobilit bap
Mar 26, 2024
2ee6435
Merge pull request #288 from beckn/sign-in-flow
ujjwal502 Mar 26, 2024
526033a
Merge pull request #287 from beckn/mobility-bap
kundanEminds Mar 27, 2024
490f824
feat: homepage ui with bb
Mar 27, 2024
1907105
Merge pull request #292 from beckn/dsep-home-page
ujjwal502 Mar 27, 2024
28f4222
feat: pushing gitignore in dsep
Mar 28, 2024
d8f7834
feat: initial setup of tourism app
Mar 28, 2024
0d79d14
feat: search API integration, type creations and data mapping in hooks
Mar 28, 2024
6de1842
Merge pull request #380 from beckn/tourism-app
ujjwal502 Mar 28, 2024
453a26f
fix: product-summary
ankitShogun Mar 29, 2024
c435d32
Merge pull request #381 from beckn/search-api-integration
ujjwal502 Mar 29, 2024
36bcb5c
feat: auth rtk query integrated properly
ankitShogun Mar 30, 2024
3f12266
feat: search data mapping in low level components
Mar 29, 2024
8a74f44
Merge pull request #441 from beckn/search-api-integration
ujjwal502 Apr 1, 2024
0a9442e
feat: adding generic client layer url
Apr 1, 2024
0a578c4
feat: courses product description page
Apr 1, 2024
40c40a0
feat: integrating gcl
ankitShogun Apr 1, 2024
54ca983
Merge pull request #461 from beckn/dsep-product-description
ujjwal502 Apr 2, 2024
01131b2
feat: adding some changes in the product price bb
Apr 2, 2024
c265ed9
Merge pull request #467 from beckn/dsep-product-description
ujjwal502 Apr 2, 2024
518f975
Merge pull request #464 from beckn/rtk-query-integration
ankitShogun Apr 2, 2024
180a589
feat: course select changes
Apr 2, 2024
80878a3
Merge pull request #472 from beckn/dsep-product-description
ujjwal502 Apr 2, 2024
22d58ae
feat: cart transformer added
ankitShogun Apr 2, 2024
bb89679
feat: cart & checkout
ankitShogun Apr 2, 2024
e59ace3
Merge pull request #477 from beckn/rtk-query-integration
ankitShogun Apr 2, 2024
0088a43
feat: init call initiated
ankitShogun Apr 2, 2024
6d18378
feat: adding init flow (ui, api and data mapping )
Apr 3, 2024
d396f1a
feat: checkout integrated & order details
ankitShogun Apr 3, 2024
b19cb5e
Merge pull request #492 from beckn/courses-init
ujjwal502 Apr 3, 2024
dc76f60
feat: course confirm changes
Apr 3, 2024
c8e6994
Merge pull request #495 from beckn/course-confirm
ujjwal502 Apr 3, 2024
27066be
feat: ui fixes
ankitShogun Apr 4, 2024
af56742
fix: props exported
ankitShogun Apr 4, 2024
5dd68ac
fix: fixed product summary page
Apr 4, 2024
fe156b6
Merge pull request #496 from beckn/kuza-one-product-summary
ankitShogun Apr 4, 2024
9dc0d3e
fix: ui fix 2
ankitShogun Apr 4, 2024
9593046
fix: fixed cart ui issue
Apr 4, 2024
9a74368
feat: coffee catalogs integrated
ankitShogun Apr 4, 2024
4bc1458
Merge pull request #500 from beckn/kuza-one-cart-fix
ankitShogun Apr 4, 2024
0562b7f
feat: order details data mapping
Apr 4, 2024
43724b0
feat: updated changes
ankitShogun Apr 4, 2024
d58ab70
fix: fixed filter functionality
Apr 4, 2024
28b6224
Merge pull request #501 from beckn/kuza-one-ui-fixesV1
ankitShogun Apr 4, 2024
28bfb4a
fix: bottom header fixes
skrushna1704 Apr 4, 2024
0c134b5
Merge pull request #502 from beckn/kuza-one-bugFixes
ankitShogun Apr 4, 2024
d1051b9
feat: product details ui improved
ankitShogun Apr 4, 2024
013237d
Merge pull request #493 from beckn/kuza-one
ankitShogun Apr 4, 2024
dcd7653
fix: ui fixes
ankitShogun Apr 5, 2024
eee2eb7
fix: file structure corrected
ankitShogun Apr 5, 2024
260b4f9
fix: ui
ankitShogun Apr 5, 2024
c9e278d
fix: build issue
ankitShogun Apr 5, 2024
fc99d11
fix: fixed order details data
Apr 5, 2024
5523d8d
Merge pull request #513 from beckn/kuza-one-order-details
ankitShogun Apr 5, 2024
bc2baa4
fix: cuurency issuue and some ui issue
skrushna1704 Apr 5, 2024
f1e3789
Merge pull request #515 from beckn/kuzaOne-currencyBugs
ankitShogun Apr 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
# yarn lint-staged
2 changes: 1 addition & 1 deletion apps/dsep/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NEXT_PUBLIC_BECKN_API_URL=https://api.osm-dev.becknprotocol.io
NEXT_PUBLIC_API_URL=https://api-node-dev.mobilityreferencebap.becknprotocol.io
NEXT_PUBLIC_API_URL=https://generic-client-layer.becknprotocol.io
NEXT_PUBLIC_NOMINATIM_URL=https://nominatim.openstreetmap.org
NEXT_PUBLIC_STRAPI_URL=https://strapi-bap.becknprotocol.io/api
NEXT_PUBLIC_DSEP_URL=https://dsep-test.becknprotocol.io
Expand Down
37 changes: 37 additions & 0 deletions apps/dsep/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
/.pnp
.pnp.js
yarn.lock

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
101 changes: 0 additions & 101 deletions apps/dsep/components/cart/CartBox.tsx

This file was deleted.

24 changes: 0 additions & 24 deletions apps/dsep/components/cart/CartIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import React, { useRef } from 'react'
import Link from 'next/link'
import { useDispatch, useSelector } from 'react-redux'
import { Transition } from 'react-transition-group'
import { AiOutlineShoppingCart } from 'react-icons/ai'
import { cartUiActions } from '../../store/cartUI-slice'
import CartBox from './CartBox'
import { ICartUiRootState, ICartRootState } from '../../lib/types/cart'
import { useLanguage } from '../../hooks/useLanguage'

const Basket = () => {
const dispatch = useDispatch()
const { locale } = useLanguage()
const showCartBox = useSelector((state: ICartUiRootState) => state.cartUi.cartBoxIsVisible)
const cartItemQuantity = useSelector((state: ICartRootState) => state.cart.totalQuantity)

const nodeRef = useRef<HTMLDivElement>(null)

function onMouseHoverHandler(toggle: boolean) {
dispatch(cartUiActions.toggleCartBox(toggle))
}
Expand Down Expand Up @@ -46,24 +40,6 @@ const Basket = () => {
</span>
</a>
</Link>
<Transition
nodeRef={nodeRef}
in={showCartBox}
timeout={300}
mountOnEnter
unmountOnExit
>
{state => {
return (
<div
ref={nodeRef}
className="z-[100]"
>
<CartBox />
</div>
)
}}
</Transition>
</div>
)
}
Expand Down
82 changes: 18 additions & 64 deletions apps/dsep/components/cart/CartItem.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,45 @@
import { Box, Image, Text, Flex } from '@chakra-ui/react'
import { Image } from '@chakra-ui/react'
import { useRouter } from 'next/router'
import React, { useState } from 'react'
import { HiMinusSm, HiOutlinePlusSm, HiOutlineTrash } from 'react-icons/hi'
import { useSelector } from 'react-redux'
import { useDispatch } from 'react-redux'
import { useLanguage } from '../../hooks/useLanguage'
import useRequest from '../../hooks/useRequest'
import { CartItemForRequest, DataPerBpp, ICartRootState, TransactionIdRootState } from '../../lib/types/cart'
import { RetailItem } from '../../lib/types/products'
import { ICartRootState } from '../../lib/types/cart'
import { cartActions } from '../../store/cart-slice'
import { getCartItemsPerBpp, getPayloadForQuoteRequest } from '../../utilities/cart-utils'
import AddBillingButton from '../detailsCard/AddBillingButton'
import DetailsCard from '../detailsCard/DetailsCard'
import ScholarshipAddButton from '../scholarship/scholarshipAddButton/ScholarshipAddButton'
import ProductPrice from '../UI/ProductPrice'
import addShippingBtn from '../../public/images/offer.svg'
import { getPayloadForSelectRequest } from '../../utilities/cart-utils'

import { ParsedItemModel } from '../../types/search.types'
import { Item } from '../../lib/types/select.types'
import { ProductPrice } from '@beckn-ui/becknified-components'

interface Props {
product: RetailItem
product: Item
setIsLoadingForCartCountChange: Function
}
const CartItem: React.FC<Props> = ({ product, setIsLoadingForCartCountChange }) => {
const quoteRequest = useRequest()
const cartItems = useSelector((state: ICartRootState) => state.cart.items)
const transactionId = useSelector((state: { transactionId: TransactionIdRootState }) => state.transactionId)
const cartItemsPerBppPerProvider: DataPerBpp = getCartItemsPerBpp(cartItems as CartItemForRequest[])
const payLoadForQuoteRequest = getPayloadForQuoteRequest(cartItemsPerBppPerProvider, transactionId)
const payLoadForQuoteRequest = getPayloadForSelectRequest(cartItems)
const apiUrl = process.env.NEXT_PUBLIC_API_URL

const scholarshipId = useSelector((state: any) => state.scholarshipCart.scholarshipId)
const scholarshipTitle = useSelector((state: any) => state.scholarshipCart.scholarshipTitle)

const productQuantity = useSelector(
(state: ICartRootState) => state.cart.items.find(item => item.id === product.id)?.quantity
(state: ICartRootState) => state.cart.items.find(item => item.item.id === product.id)?.quantity
)
const [counter, setCounter] = useState(productQuantity)
const dispatch = useDispatch()
const { t } = useLanguage()
const router = useRouter()

const fetchQuotes = () => {
setIsLoadingForCartCountChange(true)
quoteRequest
.fetchData(`${apiUrl}/client/v2/get_quote`, 'POST', payLoadForQuoteRequest)
.fetchData(`${apiUrl}/select`, 'POST', payLoadForQuoteRequest)
.then(data => setIsLoadingForCartCountChange(false))
.catch(e => console.error(e))
}

function increment(product: RetailItem) {
function increment(product: ParsedItemModel) {
setCounter(prev => ++prev!)
dispatch(cartActions.addItemToCart({ product: product, quantity: 1 }))
fetchQuotes()
Expand All @@ -59,12 +51,6 @@ const CartItem: React.FC<Props> = ({ product, setIsLoadingForCartCountChange })
fetchQuotes()
}

function onInputNumberChangeHandler(e: React.ChangeEvent<HTMLInputElement>) {
if (+e.currentTarget.value >= 1 && +e.currentTarget.value <= 10) {
setCounter(+e.currentTarget.value)
}
}

return (
<>
<div className="flex items-center flex-wrap sm:my-4 sm:py-4 px-2 border-b-2 mb-4">
Expand Down Expand Up @@ -92,8 +78,10 @@ const CartItem: React.FC<Props> = ({ product, setIsLoadingForCartCountChange })
}}
>
<Image
src={product.descriptor.images[0]}
alt={product.descriptor.name}
// TODO :- To check this after we get image from select
src=""
// src={product.images[0].url}
alt={'product-name'}
className="object-contain"
/>
</div>
Expand Down Expand Up @@ -139,7 +127,7 @@ const CartItem: React.FC<Props> = ({ product, setIsLoadingForCartCountChange })
fontSize: '17px'
}}
>
{product.descriptor.name}
{product.name}
</div>
</a>
{/* </Link> */}
Expand All @@ -161,45 +149,11 @@ const CartItem: React.FC<Props> = ({ product, setIsLoadingForCartCountChange })

<ProductPrice
price={parseFloat(product.price.value) * counter!}
isLargeSize
currencyType={product.price.currency}
/>
</div>
</div>
</div>
<Box>
<Text
mb="10px"
fontSize={'17px'}
>
{t.scholarship}
</Text>
{scholarshipId ? (
<DetailsCard>
<Flex alignItems={'center'}>
<Image
alt="shippingBtnImage"
src={addShippingBtn}
/>
<Text ml={'8px'}>
<span
style={{
fontWeight: 'bold'
}}
>
‘{scholarshipId}-{scholarshipTitle}’
</span>
</Text>
</Flex>
<Text ml={'35px'}>{t.scholarshipApplied}</Text>
</DetailsCard>
) : (
<ScholarshipAddButton
image={'+'}
text={t.checkforScholarship}
handleButtonClick={() => router.push('/myScholarship')}
/>
)}
</Box>
</>
)
}
Expand Down
Loading