ordering-ui-external 1.7.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_bundles/0.ordering-ui.a7de4e953ec3c5879d9b.js +1 -0
- package/_bundles/{1.ordering-ui.8b7044a2b34939a44465.js → 1.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
- package/_bundles/2.ordering-ui.a7de4e953ec3c5879d9b.js +1 -0
- package/_bundles/{4.ordering-ui.8b7044a2b34939a44465.js → 4.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
- package/_bundles/{5.ordering-ui.8b7044a2b34939a44465.js → 5.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
- package/_bundles/{6.ordering-ui.8b7044a2b34939a44465.js → 6.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
- package/_bundles/{7.ordering-ui.8b7044a2b34939a44465.js → 7.ordering-ui.a7de4e953ec3c5879d9b.js} +2 -2
- package/_bundles/{7.ordering-ui.8b7044a2b34939a44465.js.LICENSE.txt → 7.ordering-ui.a7de4e953ec3c5879d9b.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.8b7044a2b34939a44465.js → 8.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
- package/_bundles/{9.ordering-ui.8b7044a2b34939a44465.js → 9.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
- package/_bundles/ordering-ui.a7de4e953ec3c5879d9b.js +2 -0
- package/_bundles/{ordering-ui.8b7044a2b34939a44465.js.LICENSE.txt → ordering-ui.a7de4e953ec3c5879d9b.js.LICENSE.txt} +0 -0
- package/_modules/components/BusinessInformation/index.js +4 -8
- package/_modules/components/OrdersOption/styles.js +4 -2
- package/_modules/components/Pagination/index.js +100 -0
- package/_modules/components/Pagination/styles.js +56 -0
- package/_modules/components/SmartAppBanner/index.js +2 -1
- package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +92 -0
- package/_modules/components/VerticalOrdersLayout/index.js +115 -41
- package/_modules/components/VerticalOrdersLayout/styles.js +25 -11
- package/_modules/index.js +7 -0
- package/_modules/themes/five/src/components/AccordionDropdown/index.js +15 -4
- package/_modules/themes/five/src/components/AccordionDropdown/styles.js +14 -4
- package/_modules/themes/five/src/components/AddressList/styles.js +2 -2
- package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +17 -10
- package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +48 -42
- package/_modules/themes/five/src/components/BusinessListingSearch/index.js +5 -1
- package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +0 -3
- package/_modules/themes/five/src/components/BusinessProductsCategories/layouts/groceries/index.js +22 -13
- package/_modules/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +15 -7
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +3 -0
- package/_modules/themes/five/src/components/BusinessTypeFilter/index.js +15 -5
- package/_modules/themes/five/src/components/BusinessesListing/index.js +6 -13
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +66 -40
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +13 -7
- package/_modules/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/index.js +16 -7
- package/_modules/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/styles.js +21 -15
- package/_modules/themes/five/src/components/CardForm/index.js +17 -3
- package/_modules/themes/five/src/components/CardForm/styles.js +14 -6
- package/_modules/themes/five/src/components/CartPopover/index.js +6 -4
- package/_modules/themes/five/src/components/CartPopover/styles.js +4 -2
- package/_modules/themes/five/src/components/Footer/index.js +16 -6
- package/_modules/themes/five/src/components/Footer/styles.js +11 -9
- package/_modules/themes/five/src/components/Header/index.js +14 -9
- package/_modules/themes/five/src/components/Header/styles.js +64 -44
- package/_modules/themes/five/src/components/HeaderOption/index.js +9 -2
- package/_modules/themes/five/src/components/HeaderOption/styles.js +8 -2
- package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +9 -3
- package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +5 -3
- package/_modules/themes/five/src/components/HorizontalOrdersLayout/index.js +9 -19
- package/_modules/themes/five/src/components/HorizontalOrdersLayout/styles.js +23 -19
- package/_modules/themes/five/src/components/InputPhoneNumber/index.js +1 -0
- package/_modules/themes/five/src/components/LoginForm/index.js +3 -2
- package/_modules/themes/five/src/components/MomentControl/index.js +4 -2
- package/_modules/themes/five/src/components/MyOrders/index.js +24 -56
- package/_modules/themes/five/src/components/MyOrders/styles.js +1 -1
- package/_modules/themes/five/src/components/OrderDetails/index.js +5 -2
- package/_modules/themes/five/src/components/OrderDetails/styles.js +24 -24
- package/_modules/themes/five/src/components/OrderItAgain/styles.js +6 -2
- package/_modules/themes/five/src/components/OrdersOption/index.js +18 -18
- package/_modules/themes/five/src/components/OrdersOption/styles.js +2 -2
- package/_modules/themes/five/src/components/PageBanner/index.js +50 -0
- package/_modules/themes/five/src/components/PageBanner/styles.js +18 -0
- package/_modules/themes/five/src/components/Pagination/index.js +99 -0
- package/_modules/themes/five/src/components/Pagination/styles.js +56 -0
- package/_modules/themes/five/src/components/ProductForm/index.js +39 -23
- package/_modules/themes/five/src/components/ProductForm/styles.js +74 -38
- package/_modules/themes/five/src/components/Promotions/index.js +7 -2
- package/_modules/themes/five/src/components/Promotions/styles.js +16 -14
- package/_modules/themes/five/src/components/RenderProductsLayout/index.js +31 -10
- package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +19 -11
- package/_modules/themes/five/src/components/SidebarMenu/styles.js +1 -1
- package/_modules/themes/five/src/components/SignUpForm/index.js +3 -2
- package/_modules/themes/five/src/components/SingleOrderCard/index.js +7 -17
- package/_modules/themes/five/src/components/SingleProductCard/index.js +7 -298
- package/_modules/themes/five/src/components/SingleProductCard/layouts/original/index.js +310 -0
- package/_modules/themes/five/src/components/SingleProductCard/{styles.js → layouts/original/styles.js} +36 -32
- package/_modules/themes/five/src/components/SingleProductCard/layouts/starbucks/index.js +305 -0
- package/_modules/themes/five/src/components/SingleProductCard/layouts/starbucks/styles.js +143 -0
- package/_modules/themes/five/src/components/StripeElementsForm/index.js +1 -0
- package/_modules/themes/five/src/components/UserPopover/index.js +3 -1
- package/_modules/themes/five/src/components/UserPopover/styles.js +4 -3
- package/_modules/themes/five/src/components/UserProfileForm/styles.js +5 -8
- package/_modules/themes/six/src/components/BusinessController/index.js +81 -15
- package/_modules/themes/six/src/components/BusinessController/styles.js +58 -30
- package/_modules/themes/six/src/components/BusinessProductsListing/SearchProducts/index.js +5 -3
- package/_modules/themes/six/src/components/BusinessesMap/styles.js +1 -1
- package/_modules/themes/six/src/components/SearchBar/index.js +19 -10
- package/_modules/themes/six/src/components/SearchBar/styles.js +44 -16
- package/index-template.js +3 -1
- package/package.json +2 -2
- package/src/components/BusinessInformation/index.js +3 -8
- package/src/components/OrdersOption/styles.js +5 -5
- package/src/components/Pagination/index.js +107 -0
- package/src/components/Pagination/styles.js +106 -0
- package/src/components/SmartAppBanner/index.js +1 -0
- package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +89 -0
- package/src/components/VerticalOrdersLayout/index.js +86 -48
- package/src/components/VerticalOrdersLayout/styles.js +66 -22
- package/src/index.js +2 -0
- package/src/themes/five/src/components/AccordionDropdown/index.js +19 -6
- package/src/themes/five/src/components/AccordionDropdown/styles.js +25 -1
- package/src/themes/five/src/components/AddressList/styles.js +2 -0
- package/src/themes/five/src/components/BusinessBasicInformation/index.js +21 -11
- package/src/themes/five/src/components/BusinessBasicInformation/styles.js +9 -3
- package/src/themes/five/src/components/BusinessListingSearch/index.js +1 -0
- package/src/themes/five/src/components/BusinessProductsCategories/index.js +0 -2
- package/src/themes/five/src/components/BusinessProductsCategories/layouts/groceries/index.js +23 -12
- package/src/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +12 -4
- package/src/themes/five/src/components/BusinessProductsListing/index.js +3 -0
- package/src/themes/five/src/components/BusinessTypeFilter/index.js +15 -5
- package/src/themes/five/src/components/BusinessesListing/index.js +5 -5
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +54 -25
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +40 -26
- package/src/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/index.js +19 -6
- package/src/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/styles.js +38 -3
- package/src/themes/five/src/components/CardForm/index.js +49 -8
- package/src/themes/five/src/components/CardForm/styles.js +20 -2
- package/src/themes/five/src/components/CartPopover/index.js +2 -1
- package/src/themes/five/src/components/CartPopover/styles.js +3 -3
- package/src/themes/five/src/components/Footer/index.js +15 -6
- package/src/themes/five/src/components/Footer/styles.js +15 -14
- package/src/themes/five/src/components/Header/index.js +6 -4
- package/src/themes/five/src/components/Header/styles.js +14 -11
- package/src/themes/five/src/components/HeaderOption/index.js +13 -10
- package/src/themes/five/src/components/HeaderOption/styles.js +2 -2
- package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +22 -10
- package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +8 -0
- package/src/themes/five/src/components/HorizontalOrdersLayout/index.js +24 -36
- package/src/themes/five/src/components/HorizontalOrdersLayout/styles.js +12 -1
- package/src/themes/five/src/components/InputPhoneNumber/index.js +1 -0
- package/src/themes/five/src/components/LoginForm/index.js +2 -1
- package/src/themes/five/src/components/MomentControl/index.js +3 -2
- package/src/themes/five/src/components/MyOrders/index.js +20 -62
- package/src/themes/five/src/components/MyOrders/styles.js +1 -2
- package/src/themes/five/src/components/OrderDetails/index.js +9 -0
- package/src/themes/five/src/components/OrderDetails/styles.js +0 -55
- package/src/themes/five/src/components/OrderItAgain/styles.js +18 -0
- package/src/themes/five/src/components/OrdersOption/index.js +10 -16
- package/src/themes/five/src/components/OrdersOption/styles.js +1 -3
- package/src/themes/five/src/components/PageBanner/index.js +58 -0
- package/src/themes/five/src/components/PageBanner/styles.js +58 -0
- package/src/themes/five/src/components/Pagination/index.js +106 -0
- package/src/themes/five/src/components/Pagination/styles.js +106 -0
- package/src/themes/five/src/components/ProductForm/index.js +108 -84
- package/src/themes/five/src/components/ProductForm/styles.js +94 -12
- package/src/themes/five/src/components/Promotions/index.js +22 -16
- package/src/themes/five/src/components/Promotions/styles.js +10 -4
- package/src/themes/five/src/components/RenderProductsLayout/index.js +94 -66
- package/src/themes/five/src/components/RenderProductsLayout/styles.js +23 -22
- package/src/themes/five/src/components/SidebarMenu/styles.js +1 -1
- package/src/themes/five/src/components/SignUpForm/index.js +2 -1
- package/src/themes/five/src/components/SingleOrderCard/index.js +0 -21
- package/src/themes/five/src/components/SingleProductCard/index.js +7 -300
- package/src/themes/five/src/components/SingleProductCard/layouts/original/index.js +312 -0
- package/src/themes/five/src/components/SingleProductCard/{styles.js → layouts/original/styles.js} +9 -5
- package/src/themes/five/src/components/SingleProductCard/layouts/starbucks/index.js +313 -0
- package/src/themes/five/src/components/SingleProductCard/layouts/starbucks/styles.js +353 -0
- package/src/themes/five/src/components/StripeElementsForm/index.js +1 -0
- package/src/themes/five/src/components/UserPopover/index.js +2 -0
- package/src/themes/five/src/components/UserPopover/styles.js +2 -2
- package/src/themes/five/src/components/UserProfileForm/styles.js +3 -11
- package/src/themes/six/src/components/BusinessController/index.js +163 -62
- package/src/themes/six/src/components/BusinessController/styles.js +53 -14
- package/src/themes/six/src/components/BusinessProductsListing/SearchProducts/index.js +3 -1
- package/src/themes/six/src/components/BusinessesMap/styles.js +1 -1
- package/src/themes/six/src/components/SearchBar/index.js +27 -8
- package/src/themes/six/src/components/SearchBar/styles.js +33 -2
- package/template/app.js +364 -364
- package/template/assets/images/chew_logo.png +0 -0
- package/template/components/HelmetTags/index.js +5 -4
- package/_bundles/0.ordering-ui.8b7044a2b34939a44465.js +0 -1
- package/_bundles/2.ordering-ui.8b7044a2b34939a44465.js +0 -1
- package/_bundles/ordering-ui.8b7044a2b34939a44465.js +0 -2
|
@@ -1,309 +1,16 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import Skeleton from 'react-loading-skeleton'
|
|
3
|
-
import { useLanguage, useConfig, useOrder, useUtils, useSession, useOrderingTheme, SingleProductCard as SingleProductCardController } from 'ordering-components-external'
|
|
4
|
-
import { shape } from '../../../../../utils'
|
|
5
|
-
import { useIntersectionObserver } from '../../../../../hooks/useIntersectionObserver'
|
|
6
|
-
import { Heart as DisLike, HeartFill as Like } from 'react-bootstrap-icons'
|
|
1
|
+
import React from 'react'
|
|
7
2
|
import { useTheme } from 'styled-components'
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { SignUpForm } from '../SignUpForm'
|
|
11
|
-
import { ForgotPasswordForm } from '../ForgotPasswordForm'
|
|
12
|
-
import { Alert } from '../Confirm'
|
|
3
|
+
import { SingleProductCard as SingleProductCardOriginal } from './layouts/original'
|
|
4
|
+
import { SingleProductCard as SingleProductCardStarbucks } from './layouts/starbucks'
|
|
13
5
|
|
|
14
|
-
|
|
15
|
-
CardContainer,
|
|
16
|
-
CardInfo,
|
|
17
|
-
WrapLogo,
|
|
18
|
-
CardLogo,
|
|
19
|
-
SoldOut,
|
|
20
|
-
PriceWrapper,
|
|
21
|
-
QuantityContainer,
|
|
22
|
-
RibbonBox,
|
|
23
|
-
TitleWrapper,
|
|
24
|
-
LastOrder,
|
|
25
|
-
SkeletonCardInfo,
|
|
26
|
-
SkeletonCardLogo
|
|
27
|
-
} from './styles'
|
|
28
|
-
import { Button } from '../../styles/Buttons'
|
|
29
|
-
|
|
30
|
-
const SingleProductCardUI = (props) => {
|
|
31
|
-
const {
|
|
32
|
-
product,
|
|
33
|
-
isSoldOut,
|
|
34
|
-
isSkeleton,
|
|
35
|
-
onProductClick,
|
|
36
|
-
isCartOnProductsList,
|
|
37
|
-
useCustomFunctionality,
|
|
38
|
-
onCustomClick,
|
|
39
|
-
customText,
|
|
40
|
-
customStyle,
|
|
41
|
-
useKioskApp,
|
|
42
|
-
productAddedToCartLength,
|
|
43
|
-
handleFavoriteProduct,
|
|
44
|
-
isFavorite,
|
|
45
|
-
isPreviously
|
|
46
|
-
} = props
|
|
47
|
-
|
|
48
|
-
const [, t] = useLanguage()
|
|
49
|
-
const [$element, isObserved] = useIntersectionObserver()
|
|
50
|
-
const [stateConfig] = useConfig()
|
|
51
|
-
const [{ parsePrice, optimizeImage, parseDate }] = useUtils()
|
|
52
|
-
const [orderState] = useOrder()
|
|
53
|
-
const [{ auth }, { login }] = useSession()
|
|
54
|
-
const [orderingTheme] = useOrderingTheme()
|
|
6
|
+
export const SingleProductCard = (props) => {
|
|
55
7
|
const theme = useTheme()
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
const [isModalOpen, setIsModalOpen] = useState(false)
|
|
59
|
-
const [modalPageToShow, setModalPageToShow] = useState(null)
|
|
60
|
-
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
61
|
-
|
|
62
|
-
const editMode = typeof product?.code !== 'undefined'
|
|
63
|
-
const isObservedValidation = isObserved || useKioskApp
|
|
64
|
-
|
|
65
|
-
const removeToBalance = editMode ? product?.quantity : 0
|
|
66
|
-
|
|
67
|
-
const cartProducts = Object.values(orderState.carts).reduce((products, _cart) => [...products, ..._cart?.products], [])
|
|
68
|
-
const productBalance = cartProducts.reduce((sum, _product) => sum + (_product.id === product?.id ? _product.quantity : 0), 0)
|
|
69
|
-
|
|
70
|
-
const totalBalance = (productBalance || 0) - removeToBalance
|
|
71
|
-
|
|
72
|
-
const maxCartProductConfig = (stateConfig.configs.max_product_amount ? parseInt(stateConfig.configs.max_product_amount) : 100) - totalBalance
|
|
73
|
-
|
|
74
|
-
const hideAddButton = theme?.business_view?.components?.products?.components?.add_to_cart_button?.hidden ?? true
|
|
75
|
-
// const productsRows = theme?.layouts?.business_view?.components?.products?.components?.layout?.rows
|
|
76
|
-
|
|
77
|
-
let maxCartProductInventory = (product?.inventoried ? product?.quantity : undefined) - totalBalance
|
|
78
|
-
maxCartProductInventory = !isNaN(maxCartProductInventory) ? maxCartProductInventory : maxCartProductConfig
|
|
79
|
-
|
|
80
|
-
const maxProductQuantity = Math.min(maxCartProductConfig, maxCartProductInventory)
|
|
81
|
-
|
|
82
|
-
const handleClickProduct = (e) => {
|
|
83
|
-
if (favoriteRef?.current?.contains(e.target)) return
|
|
84
|
-
if (productAddedToCartLength && product?.maximum_per_order && productAddedToCartLength >= product?.maximum_per_order) {
|
|
85
|
-
setAlertState({
|
|
86
|
-
open: true,
|
|
87
|
-
content: [t('PRODUCT_ON_MAXIMUM_ORDER', 'The product is on maximum order')]
|
|
88
|
-
})
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (isFavorite) {
|
|
93
|
-
onProductClick && onProductClick()
|
|
94
|
-
return
|
|
95
|
-
}
|
|
96
|
-
(!isSkeleton && !useCustomFunctionality && onProductClick && onProductClick(product, product?.business?.slug)) ||
|
|
97
|
-
(useCustomFunctionality && onCustomClick && onCustomClick())
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const closeAlert = () => {
|
|
101
|
-
setAlertState({
|
|
102
|
-
open: false,
|
|
103
|
-
content: []
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const handleChangeFavorite = () => {
|
|
108
|
-
if (auth) {
|
|
109
|
-
handleFavoriteProduct && handleFavoriteProduct(!product?.favorite)
|
|
110
|
-
} else {
|
|
111
|
-
setModalPageToShow('login')
|
|
112
|
-
setIsModalOpen(true)
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const closeAuthModal = () => {
|
|
117
|
-
setIsModalOpen(false)
|
|
118
|
-
setModalPageToShow(null)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const handleSuccessLogin = (user) => {
|
|
122
|
-
if (user) {
|
|
123
|
-
closeAuthModal()
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const handleCustomModalClick = (e, { page }) => {
|
|
128
|
-
e.preventDefault()
|
|
129
|
-
setModalPageToShow(page)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const handleSuccessSignup = (user) => {
|
|
133
|
-
login({
|
|
134
|
-
user,
|
|
135
|
-
token: user?.session?.access_token
|
|
136
|
-
})
|
|
137
|
-
}
|
|
8
|
+
const layout = theme?.business_view?.components?.products?.components?.layout?.type || 'original'
|
|
138
9
|
|
|
139
10
|
return (
|
|
140
11
|
<>
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
soldOut={isSoldOut || maxProductQuantity <= 0}
|
|
144
|
-
onClick={handleClickProduct}
|
|
145
|
-
isCartOnProductsList={isCartOnProductsList}
|
|
146
|
-
style={useCustomFunctionality && customStyle}
|
|
147
|
-
className='product-card'
|
|
148
|
-
isShowAddButt={!useCustomFunctionality && !hideAddButton && !isSkeleton}
|
|
149
|
-
// productsRows={productsRows}
|
|
150
|
-
>
|
|
151
|
-
{isObservedValidation ? (
|
|
152
|
-
<div>
|
|
153
|
-
{!useCustomFunctionality && (
|
|
154
|
-
<>
|
|
155
|
-
{!isSkeleton && productAddedToCartLength > 0 && (
|
|
156
|
-
<QuantityContainer>
|
|
157
|
-
<span>{productAddedToCartLength}</span>
|
|
158
|
-
</QuantityContainer>
|
|
159
|
-
)}
|
|
160
|
-
<CardInfo soldOut={isSoldOut || maxProductQuantity <= 0} isBgimage={optimizeImage(product?.images || theme?.images?.dummies?.product, 'h_86,c_limit')} oneLine={isPreviously}>
|
|
161
|
-
<TitleWrapper>
|
|
162
|
-
{!isSkeleton ? (<h1>{product?.name}</h1>) : (<Skeleton width={100} />)}
|
|
163
|
-
{!useKioskApp && !isPreviously && (
|
|
164
|
-
!isSkeleton ? (
|
|
165
|
-
<span onClick={() => handleChangeFavorite()} ref={favoriteRef}>
|
|
166
|
-
{product?.favorite ? <Like /> : <DisLike />}
|
|
167
|
-
</span>
|
|
168
|
-
) : (<Skeleton width={16} height={16} />)
|
|
169
|
-
)}
|
|
170
|
-
</TitleWrapper>
|
|
171
|
-
{!isSkeleton ? (
|
|
172
|
-
<PriceWrapper>
|
|
173
|
-
<span>{product?.price ? parsePrice(product?.price) : ''}</span>
|
|
174
|
-
{!(isSoldOut || maxProductQuantity <= 0) && (
|
|
175
|
-
<span className='off-price'>{product?.offer_price && product?.in_offer ? parsePrice(product?.offer_price) : ''}</span>
|
|
176
|
-
)}
|
|
177
|
-
</PriceWrapper>
|
|
178
|
-
) : (
|
|
179
|
-
<Skeleton width={100} />
|
|
180
|
-
)}
|
|
181
|
-
{!isSkeleton ? (<p>{product?.description}</p>) : (<Skeleton width={100} />)}
|
|
182
|
-
{isPreviously && (!isSkeleton ? (<LastOrder>{t('LAST_ORDERED_ON', 'Last ordered on')} {parseDate(product?.last_ordered_date, { outputFormat: 'MMM DD, YYYY' })}</LastOrder>) : (<Skeleton width={80} />))}
|
|
183
|
-
</CardInfo>
|
|
184
|
-
{!isSkeleton ? (
|
|
185
|
-
<WrapLogo isBgimage={optimizeImage(product?.images || theme?.images?.dummies?.product, 'h_86,c_limit')}>
|
|
186
|
-
{product?.ribbon?.enabled && (
|
|
187
|
-
<RibbonBox
|
|
188
|
-
bgColor={product?.ribbon?.color}
|
|
189
|
-
isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
|
|
190
|
-
isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
|
|
191
|
-
>
|
|
192
|
-
{product?.ribbon?.text}
|
|
193
|
-
</RibbonBox>
|
|
194
|
-
)}
|
|
195
|
-
<CardLogo
|
|
196
|
-
className='image'
|
|
197
|
-
soldOut={isSoldOut || maxProductQuantity <= 0}
|
|
198
|
-
bgimage={optimizeImage(product?.images || theme?.images?.dummies?.product, 'h_86,c_limit')}
|
|
199
|
-
/>
|
|
200
|
-
</WrapLogo>
|
|
201
|
-
) : (
|
|
202
|
-
<Skeleton height={75} width={75} />
|
|
203
|
-
)}
|
|
204
|
-
{(isSoldOut || maxProductQuantity <= 0) && <SoldOut isBottom={product?.ribbon?.enabled}>{t('SOLD_OUT', 'SOLD OUT')}</SoldOut>}
|
|
205
|
-
</>
|
|
206
|
-
)}
|
|
207
|
-
{useCustomFunctionality && customText && (
|
|
208
|
-
<span style={{ fontSize: 16, fontWeight: 500 }}>{customText}</span>
|
|
209
|
-
)}
|
|
210
|
-
</div>
|
|
211
|
-
) : (
|
|
212
|
-
<div>
|
|
213
|
-
<SkeletonCardInfo>
|
|
214
|
-
<Skeleton width={100} />
|
|
215
|
-
<Skeleton width={100} />
|
|
216
|
-
<Skeleton width={100} />
|
|
217
|
-
</SkeletonCardInfo>
|
|
218
|
-
<SkeletonCardLogo>
|
|
219
|
-
<Skeleton height={75} width={75} />
|
|
220
|
-
</SkeletonCardLogo>
|
|
221
|
-
</div>
|
|
222
|
-
)}
|
|
223
|
-
{!useCustomFunctionality && !hideAddButton && !isSkeleton && (
|
|
224
|
-
<Button outline color='primary' disabled={productAddedToCartLength && product?.maximum_per_order && productAddedToCartLength >= product?.maximum_per_order}>
|
|
225
|
-
{t('ADD', 'Add')}
|
|
226
|
-
</Button>
|
|
227
|
-
)}
|
|
228
|
-
</CardContainer>
|
|
229
|
-
<Modal
|
|
230
|
-
open={isModalOpen}
|
|
231
|
-
onRemove={() => closeAuthModal()}
|
|
232
|
-
onClose={() => closeAuthModal()}
|
|
233
|
-
width='50%'
|
|
234
|
-
authModal
|
|
235
|
-
>
|
|
236
|
-
{modalPageToShow === 'login' && (
|
|
237
|
-
<LoginForm
|
|
238
|
-
handleSuccessLogin={handleSuccessLogin}
|
|
239
|
-
elementLinkToSignup={
|
|
240
|
-
<a
|
|
241
|
-
onClick={
|
|
242
|
-
(e) => handleCustomModalClick(e, { page: 'signup' })
|
|
243
|
-
} href='#'
|
|
244
|
-
>{t('CREATE_ACCOUNT', theme?.defaultLanguages?.CREATE_ACCOUNT || 'Create account')}
|
|
245
|
-
</a>
|
|
246
|
-
}
|
|
247
|
-
elementLinkToForgotPassword={
|
|
248
|
-
<a
|
|
249
|
-
onClick={
|
|
250
|
-
(e) => handleCustomModalClick(e, { page: 'forgotpassword' })
|
|
251
|
-
} href='#'
|
|
252
|
-
>{t('RESET_PASSWORD', theme?.defaultLanguages?.RESET_PASSWORD || 'Reset password')}
|
|
253
|
-
</a>
|
|
254
|
-
}
|
|
255
|
-
useLoginByCellphone
|
|
256
|
-
isPopup
|
|
257
|
-
/>
|
|
258
|
-
)}
|
|
259
|
-
{modalPageToShow === 'signup' && (
|
|
260
|
-
<SignUpForm
|
|
261
|
-
elementLinkToLogin={
|
|
262
|
-
<a
|
|
263
|
-
onClick={
|
|
264
|
-
(e) => handleCustomModalClick(e, { page: 'login' })
|
|
265
|
-
} href='#'
|
|
266
|
-
>{t('LOGIN', theme?.defaultLanguages?.LOGIN || 'Login')}
|
|
267
|
-
</a>
|
|
268
|
-
}
|
|
269
|
-
useLoginByCellphone
|
|
270
|
-
useChekoutFileds
|
|
271
|
-
handleSuccessSignup={handleSuccessSignup}
|
|
272
|
-
isPopup
|
|
273
|
-
closeModal={() => closeAuthModal()}
|
|
274
|
-
/>
|
|
275
|
-
)}
|
|
276
|
-
{modalPageToShow === 'forgotpassword' && (
|
|
277
|
-
<ForgotPasswordForm
|
|
278
|
-
elementLinkToLogin={
|
|
279
|
-
<a
|
|
280
|
-
onClick={
|
|
281
|
-
(e) => handleCustomModalClick(e, { page: 'login' })
|
|
282
|
-
} href='#'
|
|
283
|
-
>{t('LOGIN', theme?.defaultLanguages?.LOGIN || 'Login')}
|
|
284
|
-
</a>
|
|
285
|
-
}
|
|
286
|
-
isPopup
|
|
287
|
-
/>
|
|
288
|
-
)}
|
|
289
|
-
</Modal>
|
|
290
|
-
<Alert
|
|
291
|
-
title={t('PRODUCT', 'Product')}
|
|
292
|
-
content={alertState.content}
|
|
293
|
-
acceptText={t('ACCEPT', 'Accept')}
|
|
294
|
-
open={alertState.open}
|
|
295
|
-
onClose={() => closeAlert()}
|
|
296
|
-
onAccept={() => closeAlert()}
|
|
297
|
-
closeOnBackdrop={false}
|
|
298
|
-
/>
|
|
12
|
+
{layout === 'original' && <SingleProductCardOriginal {...props} />}
|
|
13
|
+
{layout === 'starbucks' && <SingleProductCardStarbucks {...props} />}
|
|
299
14
|
</>
|
|
300
15
|
)
|
|
301
16
|
}
|
|
302
|
-
|
|
303
|
-
export const SingleProductCard = (props) => {
|
|
304
|
-
const singleProductCardProps = {
|
|
305
|
-
...props,
|
|
306
|
-
UIComponent: SingleProductCardUI
|
|
307
|
-
}
|
|
308
|
-
return <SingleProductCardController {...singleProductCardProps} />
|
|
309
|
-
}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import React, { useRef, useState } from 'react'
|
|
2
|
+
import Skeleton from 'react-loading-skeleton'
|
|
3
|
+
import { useLanguage, useConfig, useOrder, useUtils, useSession, useOrderingTheme, SingleProductCard as SingleProductCardController } from 'ordering-components-external'
|
|
4
|
+
import { shape } from '../../../../../../../utils'
|
|
5
|
+
import { useIntersectionObserver } from '../../../../../../../hooks/useIntersectionObserver'
|
|
6
|
+
import { Heart as DisLike, HeartFill as Like } from 'react-bootstrap-icons'
|
|
7
|
+
import { useTheme } from 'styled-components'
|
|
8
|
+
import { Modal } from '../../../Modal'
|
|
9
|
+
import { LoginForm } from '../../../LoginForm'
|
|
10
|
+
import { SignUpForm } from '../../../SignUpForm'
|
|
11
|
+
import { ForgotPasswordForm } from '../../../ForgotPasswordForm'
|
|
12
|
+
import { Alert } from '../../../Confirm'
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
CardContainer,
|
|
16
|
+
CardInfo,
|
|
17
|
+
WrapLogo,
|
|
18
|
+
CardLogo,
|
|
19
|
+
SoldOut,
|
|
20
|
+
PriceWrapper,
|
|
21
|
+
QuantityContainer,
|
|
22
|
+
RibbonBox,
|
|
23
|
+
TitleWrapper,
|
|
24
|
+
LastOrder,
|
|
25
|
+
SkeletonCardInfo,
|
|
26
|
+
SkeletonCardLogo
|
|
27
|
+
} from './styles'
|
|
28
|
+
import { Button } from '../../../../styles/Buttons'
|
|
29
|
+
|
|
30
|
+
const SingleProductCardUI = (props) => {
|
|
31
|
+
const {
|
|
32
|
+
product,
|
|
33
|
+
isSoldOut,
|
|
34
|
+
isSkeleton,
|
|
35
|
+
onProductClick,
|
|
36
|
+
isCartOnProductsList,
|
|
37
|
+
useCustomFunctionality,
|
|
38
|
+
onCustomClick,
|
|
39
|
+
customText,
|
|
40
|
+
customStyle,
|
|
41
|
+
useKioskApp,
|
|
42
|
+
productAddedToCartLength,
|
|
43
|
+
handleFavoriteProduct,
|
|
44
|
+
isFavorite,
|
|
45
|
+
isPreviously,
|
|
46
|
+
} = props
|
|
47
|
+
|
|
48
|
+
const [, t] = useLanguage()
|
|
49
|
+
const [$element, isObserved] = useIntersectionObserver()
|
|
50
|
+
const [stateConfig] = useConfig()
|
|
51
|
+
const [{ parsePrice, optimizeImage, parseDate }] = useUtils()
|
|
52
|
+
const [orderState] = useOrder()
|
|
53
|
+
const [{ auth }, { login }] = useSession()
|
|
54
|
+
const [orderingTheme] = useOrderingTheme()
|
|
55
|
+
const theme = useTheme()
|
|
56
|
+
const favoriteRef = useRef(null)
|
|
57
|
+
|
|
58
|
+
const [isModalOpen, setIsModalOpen] = useState(false)
|
|
59
|
+
const [modalPageToShow, setModalPageToShow] = useState(null)
|
|
60
|
+
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
61
|
+
|
|
62
|
+
const editMode = typeof product?.code !== 'undefined'
|
|
63
|
+
const isObservedValidation = isObserved || useKioskApp
|
|
64
|
+
|
|
65
|
+
const removeToBalance = editMode ? product?.quantity : 0
|
|
66
|
+
|
|
67
|
+
const cartProducts = Object.values(orderState.carts).reduce((products, _cart) => [...products, ..._cart?.products], [])
|
|
68
|
+
const productBalance = cartProducts.reduce((sum, _product) => sum + (_product.id === product?.id ? _product.quantity : 0), 0)
|
|
69
|
+
|
|
70
|
+
const totalBalance = (productBalance || 0) - removeToBalance
|
|
71
|
+
|
|
72
|
+
const maxCartProductConfig = (stateConfig.configs.max_product_amount ? parseInt(stateConfig.configs.max_product_amount) : 100) - totalBalance
|
|
73
|
+
|
|
74
|
+
const hideAddButton = theme?.business_view?.components?.products?.components?.add_to_cart_button?.hidden ?? true
|
|
75
|
+
// const productsRows = theme?.layouts?.business_view?.components?.products?.components?.layout?.rows
|
|
76
|
+
|
|
77
|
+
let maxCartProductInventory = (product?.inventoried ? product?.quantity : undefined) - totalBalance
|
|
78
|
+
maxCartProductInventory = !isNaN(maxCartProductInventory) ? maxCartProductInventory : maxCartProductConfig
|
|
79
|
+
|
|
80
|
+
const maxProductQuantity = Math.min(maxCartProductConfig, maxCartProductInventory)
|
|
81
|
+
|
|
82
|
+
const handleClickProduct = (e) => {
|
|
83
|
+
if (favoriteRef?.current?.contains(e.target)) return
|
|
84
|
+
if (productAddedToCartLength && product?.maximum_per_order && productAddedToCartLength >= product?.maximum_per_order) {
|
|
85
|
+
setAlertState({
|
|
86
|
+
open: true,
|
|
87
|
+
content: [t('PRODUCT_ON_MAXIMUM_ORDER', 'The product is on maximum order')]
|
|
88
|
+
})
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (isFavorite) {
|
|
93
|
+
onProductClick && onProductClick()
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
(!isSkeleton && !useCustomFunctionality && onProductClick && onProductClick(product, product?.business?.slug)) ||
|
|
97
|
+
(useCustomFunctionality && onCustomClick && onCustomClick())
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const closeAlert = () => {
|
|
101
|
+
setAlertState({
|
|
102
|
+
open: false,
|
|
103
|
+
content: []
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const handleChangeFavorite = () => {
|
|
108
|
+
if (auth) {
|
|
109
|
+
handleFavoriteProduct && handleFavoriteProduct(!product?.favorite)
|
|
110
|
+
} else {
|
|
111
|
+
setModalPageToShow('login')
|
|
112
|
+
setIsModalOpen(true)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const closeAuthModal = () => {
|
|
117
|
+
setIsModalOpen(false)
|
|
118
|
+
setModalPageToShow(null)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const handleSuccessLogin = (user) => {
|
|
122
|
+
if (user) {
|
|
123
|
+
closeAuthModal()
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const handleCustomModalClick = (e, { page }) => {
|
|
128
|
+
e.preventDefault()
|
|
129
|
+
setModalPageToShow(page)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const handleSuccessSignup = (user) => {
|
|
133
|
+
login({
|
|
134
|
+
user,
|
|
135
|
+
token: user?.session?.access_token
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<>
|
|
141
|
+
<CardContainer
|
|
142
|
+
ref={$element}
|
|
143
|
+
soldOut={isSoldOut || maxProductQuantity <= 0}
|
|
144
|
+
onClick={handleClickProduct}
|
|
145
|
+
isCartOnProductsList={isCartOnProductsList}
|
|
146
|
+
style={useCustomFunctionality && customStyle}
|
|
147
|
+
className='product-card'
|
|
148
|
+
isShowAddButt={!useCustomFunctionality && !hideAddButton && !isSkeleton}
|
|
149
|
+
// productsRows={productsRows}
|
|
150
|
+
>
|
|
151
|
+
{isObservedValidation ? (
|
|
152
|
+
<div>
|
|
153
|
+
{!useCustomFunctionality && (
|
|
154
|
+
<>
|
|
155
|
+
{!isSkeleton && productAddedToCartLength > 0 && (
|
|
156
|
+
<QuantityContainer>
|
|
157
|
+
<span>{productAddedToCartLength}</span>
|
|
158
|
+
</QuantityContainer>
|
|
159
|
+
)}
|
|
160
|
+
<CardInfo soldOut={isSoldOut || maxProductQuantity <= 0} isBgimage={optimizeImage(product?.images || theme?.images?.dummies?.product, 'h_86,c_limit')} oneLine={isPreviously}>
|
|
161
|
+
<TitleWrapper>
|
|
162
|
+
{!isSkeleton ? (<h1>{product?.name}</h1>) : (<Skeleton width={100} />)}
|
|
163
|
+
{!useKioskApp && !isPreviously && (
|
|
164
|
+
!isSkeleton ? (
|
|
165
|
+
<span onClick={() => handleChangeFavorite()} ref={favoriteRef}>
|
|
166
|
+
{product?.favorite ? <Like /> : <DisLike />}
|
|
167
|
+
</span>
|
|
168
|
+
) : (<Skeleton width={16} height={16} />)
|
|
169
|
+
)}
|
|
170
|
+
</TitleWrapper>
|
|
171
|
+
{!isSkeleton ? (
|
|
172
|
+
<PriceWrapper>
|
|
173
|
+
<span>{product?.price ? parsePrice(product?.price) : ''}</span>
|
|
174
|
+
{!(isSoldOut || maxProductQuantity <= 0) && (
|
|
175
|
+
<span className='off-price'>{product?.offer_price && product?.in_offer ? parsePrice(product?.offer_price) : ''}</span>
|
|
176
|
+
)}
|
|
177
|
+
</PriceWrapper>
|
|
178
|
+
) : (
|
|
179
|
+
<Skeleton width={100} />
|
|
180
|
+
)}
|
|
181
|
+
{!isSkeleton ? (<p>{product?.description}</p>) : (<Skeleton width={100} />)}
|
|
182
|
+
{isPreviously && (!isSkeleton ? (<LastOrder>{t('LAST_ORDERED_ON', 'Last ordered on')} {parseDate(product?.last_ordered_date, { outputFormat: 'MMM DD, YYYY' })}</LastOrder>) : (<Skeleton width={80} />))}
|
|
183
|
+
</CardInfo>
|
|
184
|
+
{!isSkeleton ? (
|
|
185
|
+
<WrapLogo
|
|
186
|
+
className='order-it-again-logo'
|
|
187
|
+
isBgimage={optimizeImage(product?.images || theme?.images?.dummies?.product, 'h_86,c_limit')}
|
|
188
|
+
>
|
|
189
|
+
{product?.ribbon?.enabled && (
|
|
190
|
+
<RibbonBox
|
|
191
|
+
bgColor={product?.ribbon?.color}
|
|
192
|
+
isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
|
|
193
|
+
isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
|
|
194
|
+
>
|
|
195
|
+
{product?.ribbon?.text}
|
|
196
|
+
</RibbonBox>
|
|
197
|
+
)}
|
|
198
|
+
<CardLogo
|
|
199
|
+
className='image'
|
|
200
|
+
soldOut={isSoldOut || maxProductQuantity <= 0}
|
|
201
|
+
bgimage={optimizeImage(product?.images || theme?.images?.dummies?.product, 'h_86,c_limit')}
|
|
202
|
+
/>
|
|
203
|
+
</WrapLogo>
|
|
204
|
+
) : (
|
|
205
|
+
<Skeleton height={75} width={75} />
|
|
206
|
+
)}
|
|
207
|
+
{(isSoldOut || maxProductQuantity <= 0) && <SoldOut isBottom={product?.ribbon?.enabled}>{t('SOLD_OUT', 'SOLD OUT')}</SoldOut>}
|
|
208
|
+
</>
|
|
209
|
+
)}
|
|
210
|
+
{useCustomFunctionality && customText && (
|
|
211
|
+
<span style={{ fontSize: 16, fontWeight: 500 }}>{customText}</span>
|
|
212
|
+
)}
|
|
213
|
+
</div>
|
|
214
|
+
) : (
|
|
215
|
+
<div>
|
|
216
|
+
<SkeletonCardInfo>
|
|
217
|
+
<Skeleton width={100} />
|
|
218
|
+
<Skeleton width={100} />
|
|
219
|
+
<Skeleton width={100} />
|
|
220
|
+
</SkeletonCardInfo>
|
|
221
|
+
<SkeletonCardLogo>
|
|
222
|
+
<Skeleton height={75} width={75} />
|
|
223
|
+
</SkeletonCardLogo>
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
226
|
+
{!useCustomFunctionality && !hideAddButton && !isSkeleton && (
|
|
227
|
+
<Button outline color='primary' disabled={productAddedToCartLength && product?.maximum_per_order && productAddedToCartLength >= product?.maximum_per_order}>
|
|
228
|
+
{t('ADD', 'Add')}
|
|
229
|
+
</Button>
|
|
230
|
+
)}
|
|
231
|
+
</CardContainer>
|
|
232
|
+
<Modal
|
|
233
|
+
open={isModalOpen}
|
|
234
|
+
onRemove={() => closeAuthModal()}
|
|
235
|
+
onClose={() => closeAuthModal()}
|
|
236
|
+
width='50%'
|
|
237
|
+
authModal
|
|
238
|
+
>
|
|
239
|
+
{modalPageToShow === 'login' && (
|
|
240
|
+
<LoginForm
|
|
241
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
242
|
+
elementLinkToSignup={
|
|
243
|
+
<a
|
|
244
|
+
onClick={
|
|
245
|
+
(e) => handleCustomModalClick(e, { page: 'signup' })
|
|
246
|
+
} href='#'
|
|
247
|
+
>{t('CREATE_ACCOUNT', theme?.defaultLanguages?.CREATE_ACCOUNT || 'Create account')}
|
|
248
|
+
</a>
|
|
249
|
+
}
|
|
250
|
+
elementLinkToForgotPassword={
|
|
251
|
+
<a
|
|
252
|
+
onClick={
|
|
253
|
+
(e) => handleCustomModalClick(e, { page: 'forgotpassword' })
|
|
254
|
+
} href='#'
|
|
255
|
+
>{t('RESET_PASSWORD', theme?.defaultLanguages?.RESET_PASSWORD || 'Reset password')}
|
|
256
|
+
</a>
|
|
257
|
+
}
|
|
258
|
+
useLoginByCellphone
|
|
259
|
+
isPopup
|
|
260
|
+
/>
|
|
261
|
+
)}
|
|
262
|
+
{modalPageToShow === 'signup' && (
|
|
263
|
+
<SignUpForm
|
|
264
|
+
elementLinkToLogin={
|
|
265
|
+
<a
|
|
266
|
+
onClick={
|
|
267
|
+
(e) => handleCustomModalClick(e, { page: 'login' })
|
|
268
|
+
} href='#'
|
|
269
|
+
>{t('LOGIN', theme?.defaultLanguages?.LOGIN || 'Login')}
|
|
270
|
+
</a>
|
|
271
|
+
}
|
|
272
|
+
useLoginByCellphone
|
|
273
|
+
useChekoutFileds
|
|
274
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
275
|
+
isPopup
|
|
276
|
+
closeModal={() => closeAuthModal()}
|
|
277
|
+
/>
|
|
278
|
+
)}
|
|
279
|
+
{modalPageToShow === 'forgotpassword' && (
|
|
280
|
+
<ForgotPasswordForm
|
|
281
|
+
elementLinkToLogin={
|
|
282
|
+
<a
|
|
283
|
+
onClick={
|
|
284
|
+
(e) => handleCustomModalClick(e, { page: 'login' })
|
|
285
|
+
} href='#'
|
|
286
|
+
>{t('LOGIN', theme?.defaultLanguages?.LOGIN || 'Login')}
|
|
287
|
+
</a>
|
|
288
|
+
}
|
|
289
|
+
isPopup
|
|
290
|
+
/>
|
|
291
|
+
)}
|
|
292
|
+
</Modal>
|
|
293
|
+
<Alert
|
|
294
|
+
title={t('PRODUCT', 'Product')}
|
|
295
|
+
content={alertState.content}
|
|
296
|
+
acceptText={t('ACCEPT', 'Accept')}
|
|
297
|
+
open={alertState.open}
|
|
298
|
+
onClose={() => closeAlert()}
|
|
299
|
+
onAccept={() => closeAlert()}
|
|
300
|
+
closeOnBackdrop={false}
|
|
301
|
+
/>
|
|
302
|
+
</>
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export const SingleProductCard = (props) => {
|
|
307
|
+
const singleProductCardProps = {
|
|
308
|
+
...props,
|
|
309
|
+
UIComponent: SingleProductCardUI
|
|
310
|
+
}
|
|
311
|
+
return <SingleProductCardController {...singleProductCardProps} />
|
|
312
|
+
}
|
package/src/themes/five/src/components/SingleProductCard/{styles.js → layouts/original/styles.js}
RENAMED
|
@@ -21,6 +21,7 @@ export const CardContainer = styled.div`
|
|
|
21
21
|
button {
|
|
22
22
|
width: 100%;
|
|
23
23
|
margin-top: 10px;
|
|
24
|
+
padding: 4px;
|
|
24
25
|
}
|
|
25
26
|
${({ productsRows }) => productsRows ? css`
|
|
26
27
|
width: ${() => productsRows === 3 ? 'calc(33% - 20px)' : 'calc(50% - 20px)'};
|
|
@@ -88,6 +89,9 @@ export const CardInfo = styled.div`
|
|
|
88
89
|
> * {
|
|
89
90
|
margin: 3px;
|
|
90
91
|
}
|
|
92
|
+
${({ theme }) => theme?.business_view?.components?.products?.components?.layout?.type === 'pfchangs' && css`
|
|
93
|
+
|
|
94
|
+
`}
|
|
91
95
|
p {
|
|
92
96
|
color: #909BA9;
|
|
93
97
|
text-align: left;
|
|
@@ -122,11 +126,11 @@ export const CardInfo = styled.div`
|
|
|
122
126
|
|
|
123
127
|
export const WrapLogo = styled.div`
|
|
124
128
|
position: relative;
|
|
125
|
-
max-width:
|
|
126
|
-
max-height:
|
|
127
|
-
height:
|
|
129
|
+
max-width: 120px;
|
|
130
|
+
max-height: 120px;
|
|
131
|
+
height: 120px;
|
|
128
132
|
${({ isBgimage }) => isBgimage && css`
|
|
129
|
-
width:
|
|
133
|
+
width: 120px;
|
|
130
134
|
`}
|
|
131
135
|
margin-left: 5px;
|
|
132
136
|
${props => props.theme?.rtl && css`
|
|
@@ -142,7 +146,7 @@ const CardLogoStyled = styled.div`
|
|
|
142
146
|
background-size: cover;
|
|
143
147
|
background-position: center;
|
|
144
148
|
object-fit: cover;
|
|
145
|
-
min-height:
|
|
149
|
+
min-height: 120px;
|
|
146
150
|
border-radius: 10px;
|
|
147
151
|
`
|
|
148
152
|
export const CardLogo = (props) => {
|