ordering-ui-external 14.0.5 → 14.0.7
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/{7.ordering-ui.e5571322319c3152e419.js → 7.ordering-ui.b2be153972548d48278f.js} +1 -1
- package/_bundles/{ordering-ui.e5571322319c3152e419.js → ordering-ui.b2be153972548d48278f.js} +2 -2
- package/_modules/themes/five/src/components/OrderDetails/OrderBillSection.js +5 -4
- package/_modules/themes/five/src/components/OrderDetails/index.js +32 -8
- package/_modules/themes/five/src/components/OrderDetails/layouts/Starbucks/HeaderContent.js +157 -0
- package/_modules/themes/five/src/components/OrderDetails/layouts/Starbucks/index.js +12 -0
- package/_modules/themes/five/src/components/OrderDetails/layouts/Starbucks/styles.js +37 -0
- package/_modules/themes/five/src/components/ReviewDriver/layouts/Simple/index.js +240 -0
- package/_modules/themes/five/src/components/ReviewDriver/layouts/Simple/styles.js +58 -0
- package/_modules/themes/five/src/components/ReviewOrder/layouts/Simple/index.js +247 -0
- package/_modules/themes/five/src/components/ReviewOrder/layouts/Simple/styles.js +59 -0
- package/index-template.js +11 -1
- package/package.json +2 -2
- package/src/themes/five/src/components/OrderDetails/OrderBillSection.js +190 -185
- package/src/themes/five/src/components/OrderDetails/index.js +257 -216
- package/src/themes/five/src/components/OrderDetails/layouts/Starbucks/HeaderContent.js +168 -0
- package/src/themes/five/src/components/OrderDetails/layouts/Starbucks/index.js +7 -0
- package/src/themes/five/src/components/OrderDetails/layouts/Starbucks/styles.js +148 -0
- package/src/themes/five/src/components/ReviewDriver/layouts/Simple/index.js +205 -0
- package/src/themes/five/src/components/ReviewDriver/layouts/Simple/styles.js +163 -0
- package/src/themes/five/src/components/ReviewOrder/layouts/Simple/index.js +211 -0
- package/src/themes/five/src/components/ReviewOrder/layouts/Simple/styles.js +173 -0
- package/template/assets/icons/delivered.png +0 -0
- package/template/assets/icons/driver.png +0 -0
- package/template/assets/icons/home.png +0 -0
- package/template/assets/icons/store.png +0 -0
- /package/_bundles/{0.ordering-ui.e5571322319c3152e419.js → 0.ordering-ui.b2be153972548d48278f.js} +0 -0
- /package/_bundles/{1.ordering-ui.e5571322319c3152e419.js → 1.ordering-ui.b2be153972548d48278f.js} +0 -0
- /package/_bundles/{2.ordering-ui.e5571322319c3152e419.js → 2.ordering-ui.b2be153972548d48278f.js} +0 -0
- /package/_bundles/{4.ordering-ui.e5571322319c3152e419.js → 4.ordering-ui.b2be153972548d48278f.js} +0 -0
- /package/_bundles/{5.ordering-ui.e5571322319c3152e419.js → 5.ordering-ui.b2be153972548d48278f.js} +0 -0
- /package/_bundles/{6.ordering-ui.e5571322319c3152e419.js → 6.ordering-ui.b2be153972548d48278f.js} +0 -0
- /package/_bundles/{7.ordering-ui.e5571322319c3152e419.js.LICENSE.txt → 7.ordering-ui.b2be153972548d48278f.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.e5571322319c3152e419.js → 8.ordering-ui.b2be153972548d48278f.js} +0 -0
- /package/_bundles/{9.ordering-ui.e5571322319c3152e419.js → 9.ordering-ui.b2be153972548d48278f.js} +0 -0
- /package/_bundles/{ordering-ui.e5571322319c3152e419.js.LICENSE.txt → ordering-ui.b2be153972548d48278f.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { useForm } from 'react-hook-form'
|
|
3
|
+
import {
|
|
4
|
+
useLanguage,
|
|
5
|
+
OrderReview as ReviewOrderController
|
|
6
|
+
} from 'ordering-components-external'
|
|
7
|
+
import MdClose from '@meronex/icons/md/MdClose'
|
|
8
|
+
import BsArrowRight from '@meronex/icons/bs/BsArrowRight'
|
|
9
|
+
import IfillStar from '@meronex/icons/ai/AiFillStar'
|
|
10
|
+
import IUnfillStar from '@meronex/icons/ai/AiOutlineStar'
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
Container,
|
|
14
|
+
ReviewOrderContainer,
|
|
15
|
+
Comments,
|
|
16
|
+
Send,
|
|
17
|
+
ReviewsProgressWrapper,
|
|
18
|
+
ReviewsProgressContent,
|
|
19
|
+
LogoAndReviewWrapper,
|
|
20
|
+
CommentsList,
|
|
21
|
+
CommentButton,
|
|
22
|
+
ContinueContainer
|
|
23
|
+
} from './styles'
|
|
24
|
+
|
|
25
|
+
import { Alert } from '../../../Confirm'
|
|
26
|
+
import { TextArea } from '../../../../styles/Inputs'
|
|
27
|
+
import { Button } from '../../../../styles/Buttons'
|
|
28
|
+
import { reviewCommentList } from '../../../../../../../utils'
|
|
29
|
+
|
|
30
|
+
const ReviewOrderUI = (props) => {
|
|
31
|
+
const {
|
|
32
|
+
stars,
|
|
33
|
+
handleSendReview,
|
|
34
|
+
formState,
|
|
35
|
+
setIsReviewed,
|
|
36
|
+
setStars
|
|
37
|
+
} = props
|
|
38
|
+
|
|
39
|
+
const [, t] = useLanguage()
|
|
40
|
+
const { handleSubmit, errors } = useForm()
|
|
41
|
+
const [alertState, setAlertState] = useState({ open: false, content: [], success: false })
|
|
42
|
+
const [comments, setComments] = useState([])
|
|
43
|
+
const [extraComment, setExtraComment] = useState('')
|
|
44
|
+
|
|
45
|
+
const commentsList = reviewCommentList('order')
|
|
46
|
+
|
|
47
|
+
const qualificationList = [
|
|
48
|
+
{ key: 1, text: t('TERRIBLE', 'Terrible'), middleNode: false, left: 0, right: 'initial' },
|
|
49
|
+
{ key: 2, text: t('BAD', 'Bad'), middleNode: true, left: '25%', right: '75%' },
|
|
50
|
+
{ key: 3, text: t('OKAY', 'Okay'), middleNode: true, left: '50%', right: '50%' },
|
|
51
|
+
{ key: 4, text: t('GOOD', 'Good'), middleNode: true, left: '75%', right: '25%' },
|
|
52
|
+
{ key: 5, text: t('GREAT', 'Great'), middleNode: false, left: 'initial', right: 0 }
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
const handleChangeStars = (index) => {
|
|
56
|
+
if (index) setStars({ ...stars, quality: index, punctiality: index, service: index, packaging: index, comments: '' })
|
|
57
|
+
setComments([])
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const handleChangeComment = (commentItem) => {
|
|
61
|
+
const found = comments.find((comment) => comment?.key === commentItem.key)
|
|
62
|
+
if (found) {
|
|
63
|
+
const _comments = comments.filter((comment) => comment?.key !== commentItem.key)
|
|
64
|
+
setComments(_comments)
|
|
65
|
+
} else {
|
|
66
|
+
setComments([...comments, commentItem])
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const isSelectedComment = (commentKey) => {
|
|
71
|
+
const found = comments.find((comment) => comment?.key === commentKey)
|
|
72
|
+
return found
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (!formState.loading && formState.result?.error) {
|
|
77
|
+
setAlertState({
|
|
78
|
+
open: true,
|
|
79
|
+
success: false,
|
|
80
|
+
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
if (!formState.loading && !formState.result?.error && alertState.success) {
|
|
84
|
+
setIsReviewed && setIsReviewed()
|
|
85
|
+
}
|
|
86
|
+
}, [formState])
|
|
87
|
+
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (Object.keys(errors).length > 0) {
|
|
90
|
+
setAlertState({
|
|
91
|
+
open: true,
|
|
92
|
+
success: false,
|
|
93
|
+
content: Object.values(errors).map(error => error.message)
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
}, [errors])
|
|
97
|
+
|
|
98
|
+
const onSubmit = values => {
|
|
99
|
+
if (Object.values(stars).some((value) => value === 0)) {
|
|
100
|
+
setAlertState({
|
|
101
|
+
open: true,
|
|
102
|
+
content: stars.quality === 0 ? [`${t('REVIEW_QUALIFICATION_REQUIRED', 'Review qualification is required')}`] : []
|
|
103
|
+
})
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
setAlertState({ ...alertState, success: true })
|
|
107
|
+
handleSendReview()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const closeAlert = () => {
|
|
111
|
+
setAlertState({
|
|
112
|
+
open: false,
|
|
113
|
+
content: []
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
let _comments = ''
|
|
119
|
+
if (comments.length > 0) {
|
|
120
|
+
comments.map(comment => (_comments += comment.content + '. '))
|
|
121
|
+
}
|
|
122
|
+
const _comment = _comments + extraComment
|
|
123
|
+
setStars({ ...stars, comments: _comment })
|
|
124
|
+
}, [comments, extraComment])
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<Container>
|
|
128
|
+
<LogoAndReviewWrapper>
|
|
129
|
+
<ReviewsProgressWrapper>
|
|
130
|
+
<p style={{ fontWeight: 'bold' }}>{t('HOW_WAS_YOUR_ORDER', 'How was your order?')}</p>
|
|
131
|
+
<ReviewsProgressContent>
|
|
132
|
+
{
|
|
133
|
+
qualificationList?.map(qualification => (
|
|
134
|
+
<div
|
|
135
|
+
key={qualification?.key}
|
|
136
|
+
>
|
|
137
|
+
{qualification?.key <= stars?.quality
|
|
138
|
+
? <IfillStar onClick={() => handleChangeStars(qualification?.key)} />
|
|
139
|
+
: <IUnfillStar onClick={() => handleChangeStars(qualification?.key)} />}
|
|
140
|
+
</div>
|
|
141
|
+
))
|
|
142
|
+
}
|
|
143
|
+
</ReviewsProgressContent>
|
|
144
|
+
</ReviewsProgressWrapper>
|
|
145
|
+
{stars?.quality <= 3 && (
|
|
146
|
+
<CommentsList>
|
|
147
|
+
<p>{commentsList[stars?.quality || 1]?.title}</p>
|
|
148
|
+
{
|
|
149
|
+
commentsList[stars?.quality || 1]?.list?.map((commentItem, i) => (
|
|
150
|
+
<CommentButton
|
|
151
|
+
key={i}
|
|
152
|
+
active={isSelectedComment(commentItem?.key)}
|
|
153
|
+
onClick={() => handleChangeComment(commentItem)}
|
|
154
|
+
initialIcon
|
|
155
|
+
>
|
|
156
|
+
{commentItem.content}
|
|
157
|
+
{
|
|
158
|
+
isSelectedComment(commentItem?.key) && <MdClose />
|
|
159
|
+
}
|
|
160
|
+
</CommentButton>
|
|
161
|
+
))
|
|
162
|
+
}
|
|
163
|
+
</CommentsList>
|
|
164
|
+
)}
|
|
165
|
+
</LogoAndReviewWrapper>
|
|
166
|
+
<ReviewOrderContainer onSubmit={handleSubmit(onSubmit)}>
|
|
167
|
+
<Comments>
|
|
168
|
+
<p>{t('DO_YOU_WANT_TO_ADD_SOMETHING', 'Do you want to add something?')}</p>
|
|
169
|
+
<TextArea
|
|
170
|
+
name='comments'
|
|
171
|
+
value={extraComment}
|
|
172
|
+
onChange={(e) => setExtraComment(e.target.value)}
|
|
173
|
+
autoComplete='off'
|
|
174
|
+
/>
|
|
175
|
+
</Comments>
|
|
176
|
+
<Send>
|
|
177
|
+
<Button
|
|
178
|
+
color={!formState.loading ? 'primary' : 'secondary'}
|
|
179
|
+
type='submit'
|
|
180
|
+
disabled={formState.loading}
|
|
181
|
+
className='review-sent'
|
|
182
|
+
>
|
|
183
|
+
{!formState.loading ? (
|
|
184
|
+
<ContinueContainer><p>{t('CONTINUE', 'Continue')}</p><BsArrowRight /></ContinueContainer>
|
|
185
|
+
) : t('LOADING', 'Loading')}
|
|
186
|
+
</Button>
|
|
187
|
+
</Send>
|
|
188
|
+
<Alert
|
|
189
|
+
title={t('ORDER_REVIEW', 'Order Review')}
|
|
190
|
+
content={alertState.content}
|
|
191
|
+
acceptText={t('ACCEPT', 'Accept')}
|
|
192
|
+
open={alertState.open}
|
|
193
|
+
onClose={() => closeAlert()}
|
|
194
|
+
onAccept={() => closeAlert()}
|
|
195
|
+
closeOnBackdrop={false}
|
|
196
|
+
/>
|
|
197
|
+
</ReviewOrderContainer>
|
|
198
|
+
</Container>
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export const ReviewOrder = (props) => {
|
|
203
|
+
const ReviewOrderProps = {
|
|
204
|
+
...props,
|
|
205
|
+
UIComponent: ReviewOrderUI,
|
|
206
|
+
isToast: true,
|
|
207
|
+
defaultStar: props?.defaultStar ?? 0
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return <ReviewOrderController {...ReviewOrderProps} />
|
|
211
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
import { Button } from '../../../../styles/Buttons'
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
border-radius: 7.6px;
|
|
8
|
+
padding: 20px;
|
|
9
|
+
box-shadow: 0px 4px 10px 0px #0000001F;
|
|
10
|
+
margin: 55px 0 30px;
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
export const ReviewOrderContainer = styled.form`
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
align-items: center;
|
|
17
|
+
width: 100%;
|
|
18
|
+
`
|
|
19
|
+
|
|
20
|
+
export const Comments = styled.div`
|
|
21
|
+
display: flex;
|
|
22
|
+
width: 100%;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
margin-top: 10px;
|
|
25
|
+
|
|
26
|
+
p {
|
|
27
|
+
text-transform: capitalize;
|
|
28
|
+
margin-top: 0;
|
|
29
|
+
margin-bottom: 10px;
|
|
30
|
+
font-size: 15px;
|
|
31
|
+
color: ${props => props.theme?.colors.darkTextColor};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
textarea {
|
|
35
|
+
min-height: 104px;
|
|
36
|
+
}
|
|
37
|
+
`
|
|
38
|
+
|
|
39
|
+
export const Send = styled.div`
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: flex-end;
|
|
43
|
+
margin-top: 30px;
|
|
44
|
+
width: 100%;
|
|
45
|
+
|
|
46
|
+
span {
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
font-weight: 600;
|
|
49
|
+
font-size: 16px;
|
|
50
|
+
user-select: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
button {
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
padding: 6px 20px;
|
|
56
|
+
width: 300px;
|
|
57
|
+
height: 45px;
|
|
58
|
+
line-height: 0;
|
|
59
|
+
svg {
|
|
60
|
+
color: white;
|
|
61
|
+
font-size: 21px;
|
|
62
|
+
vertical-align: middle;
|
|
63
|
+
margin-left: 8px;
|
|
64
|
+
${props => props.theme?.rtl && css`
|
|
65
|
+
margin-left: 0;
|
|
66
|
+
margin-right: 8px;
|
|
67
|
+
transform: rotateZ(180deg);
|
|
68
|
+
`}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`
|
|
72
|
+
|
|
73
|
+
export const ReviewsProgressWrapper = styled.div`
|
|
74
|
+
width: 100%;
|
|
75
|
+
margin-bottom: 20px;
|
|
76
|
+
|
|
77
|
+
p {
|
|
78
|
+
margin-top: 0;
|
|
79
|
+
margin-bottom: 17px;
|
|
80
|
+
font-size: 15px;
|
|
81
|
+
color: ${props => props.theme?.colors.darkTextColor};
|
|
82
|
+
text-align: center;
|
|
83
|
+
}
|
|
84
|
+
`
|
|
85
|
+
|
|
86
|
+
export const ReviewsProgressContent = styled.div`
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: row;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
|
|
91
|
+
svg {
|
|
92
|
+
font-size: 4rem;
|
|
93
|
+
color: ${props => props.theme?.colors.primary};
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
}
|
|
96
|
+
`
|
|
97
|
+
|
|
98
|
+
export const LogoAndReviewWrapper = styled.div`
|
|
99
|
+
width: 100%;
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
`
|
|
103
|
+
|
|
104
|
+
export const CommentsList = styled.div`
|
|
105
|
+
p {
|
|
106
|
+
margin-top: 0;
|
|
107
|
+
margin-bottom: 10px;
|
|
108
|
+
font-size: 15px;
|
|
109
|
+
color: ${props => props.theme?.colors.darkTextColor};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
button {
|
|
113
|
+
border-radius: 7.6px;
|
|
114
|
+
margin-bottom: 18px;
|
|
115
|
+
margin-right: 40px;
|
|
116
|
+
|
|
117
|
+
${props => props.theme?.rtl && css`
|
|
118
|
+
margin-left: 40px;
|
|
119
|
+
margin-right: 0;
|
|
120
|
+
`}
|
|
121
|
+
|
|
122
|
+
svg {
|
|
123
|
+
vertical-align: middle;
|
|
124
|
+
margin-left: 5px;
|
|
125
|
+
|
|
126
|
+
${props => props.theme?.rtl && css`
|
|
127
|
+
margin-right: 5px;
|
|
128
|
+
margin-left: 0;
|
|
129
|
+
`}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
`
|
|
133
|
+
|
|
134
|
+
export const CommentButton = styled(Button)`
|
|
135
|
+
border-radius: 7.6px;
|
|
136
|
+
margin-bottom: 18px;
|
|
137
|
+
margin-right: 18px;
|
|
138
|
+
font-size: 13px;
|
|
139
|
+
color: #414954;
|
|
140
|
+
background: #E9ECEF;
|
|
141
|
+
border: 1px solid #E9ECEF;
|
|
142
|
+
transition: all 0.3s linear;
|
|
143
|
+
|
|
144
|
+
${props => props.theme?.rtl && css`
|
|
145
|
+
margin-left: 18px;
|
|
146
|
+
margin-right: 0;
|
|
147
|
+
`}
|
|
148
|
+
|
|
149
|
+
svg {
|
|
150
|
+
vertical-align: middle;
|
|
151
|
+
margin-left: 5px;
|
|
152
|
+
|
|
153
|
+
${props => props.theme?.rtl && css`
|
|
154
|
+
margin-right: 5px;
|
|
155
|
+
margin-left: 0;
|
|
156
|
+
`}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
${({ active }) => active && css`
|
|
160
|
+
background: ${props => props.theme?.colors.primary};
|
|
161
|
+
border: 1px solid ${props => props.theme?.colors.primary};
|
|
162
|
+
color: white;
|
|
163
|
+
`}
|
|
164
|
+
`
|
|
165
|
+
|
|
166
|
+
export const ContinueContainer = styled.div`
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
p{
|
|
170
|
+
flex: 1;
|
|
171
|
+
margin: 0;
|
|
172
|
+
}
|
|
173
|
+
`
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
/package/_bundles/{0.ordering-ui.e5571322319c3152e419.js → 0.ordering-ui.b2be153972548d48278f.js}
RENAMED
|
File without changes
|
/package/_bundles/{1.ordering-ui.e5571322319c3152e419.js → 1.ordering-ui.b2be153972548d48278f.js}
RENAMED
|
File without changes
|
/package/_bundles/{2.ordering-ui.e5571322319c3152e419.js → 2.ordering-ui.b2be153972548d48278f.js}
RENAMED
|
File without changes
|
/package/_bundles/{4.ordering-ui.e5571322319c3152e419.js → 4.ordering-ui.b2be153972548d48278f.js}
RENAMED
|
File without changes
|
/package/_bundles/{5.ordering-ui.e5571322319c3152e419.js → 5.ordering-ui.b2be153972548d48278f.js}
RENAMED
|
File without changes
|
/package/_bundles/{6.ordering-ui.e5571322319c3152e419.js → 6.ordering-ui.b2be153972548d48278f.js}
RENAMED
|
File without changes
|
|
File without changes
|
/package/_bundles/{8.ordering-ui.e5571322319c3152e419.js → 8.ordering-ui.b2be153972548d48278f.js}
RENAMED
|
File without changes
|
/package/_bundles/{9.ordering-ui.e5571322319c3152e419.js → 9.ordering-ui.b2be153972548d48278f.js}
RENAMED
|
File without changes
|