ordering-ui-external 2.0.3 → 2.1.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.
Files changed (99) hide show
  1. package/_bundles/{0.ordering-ui.a228aa8797d9d0fc5a6c.js → 0.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  2. package/_bundles/{1.ordering-ui.a228aa8797d9d0fc5a6c.js → 1.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  3. package/_bundles/{2.ordering-ui.a228aa8797d9d0fc5a6c.js → 2.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  4. package/_bundles/{4.ordering-ui.a228aa8797d9d0fc5a6c.js → 4.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  5. package/_bundles/{5.ordering-ui.a228aa8797d9d0fc5a6c.js → 5.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  6. package/_bundles/{6.ordering-ui.a228aa8797d9d0fc5a6c.js → 6.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  7. package/_bundles/{7.ordering-ui.a228aa8797d9d0fc5a6c.js → 7.ordering-ui.3861d1cf52cf041c74c5.js} +1 -1
  8. package/_bundles/{7.ordering-ui.a228aa8797d9d0fc5a6c.js.LICENSE.txt → 7.ordering-ui.3861d1cf52cf041c74c5.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.a228aa8797d9d0fc5a6c.js → 8.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  10. package/_bundles/{9.ordering-ui.a228aa8797d9d0fc5a6c.js → 9.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  11. package/_bundles/{ordering-ui.a228aa8797d9d0fc5a6c.js → ordering-ui.3861d1cf52cf041c74c5.js} +2 -2
  12. package/_bundles/{ordering-ui.a228aa8797d9d0fc5a6c.js.LICENSE.txt → ordering-ui.3861d1cf52cf041c74c5.js.LICENSE.txt} +0 -0
  13. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +36 -28
  14. package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +48 -34
  15. package/_modules/themes/five/src/components/BusinessItemAccordion/index.js +3 -1
  16. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +9 -2
  17. package/_modules/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +1 -1
  18. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +2 -1
  19. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +1 -1
  20. package/_modules/themes/five/src/components/Cart/index.js +73 -25
  21. package/_modules/themes/five/src/components/CartContent/index.js +3 -1
  22. package/_modules/themes/five/src/components/Checkout/index.js +25 -15
  23. package/_modules/themes/five/src/components/DriverTips/index.js +26 -15
  24. package/_modules/themes/five/src/components/GiftCard/GiftCardUI/index.js +63 -0
  25. package/_modules/themes/five/src/components/GiftCard/GiftCardUI/styles.js +27 -0
  26. package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +69 -0
  27. package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +29 -0
  28. package/_modules/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +123 -0
  29. package/_modules/themes/five/src/components/GiftCard/RedeemGiftCard/styles.js +20 -0
  30. package/_modules/themes/five/src/components/GiftCard/SendGiftCard/index.js +114 -0
  31. package/_modules/themes/five/src/components/GiftCard/SendGiftCard/styles.js +14 -0
  32. package/_modules/themes/five/src/components/HorizontalOrdersLayout/index.js +3 -1
  33. package/_modules/themes/five/src/components/HorizontalOrdersLayout/styles.js +1 -1
  34. package/_modules/themes/five/src/components/LoginForm/index.js +6 -0
  35. package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +69 -0
  36. package/_modules/themes/five/src/components/OrderDetails/index.js +84 -76
  37. package/_modules/themes/five/src/components/OrderDetails/styles.js +1 -1
  38. package/_modules/themes/five/src/components/OrderItAgain/styles.js +3 -3
  39. package/_modules/themes/five/src/components/OrderProgress/index.js +5 -14
  40. package/_modules/themes/five/src/components/PaymentOptions/index.js +22 -8
  41. package/_modules/themes/five/src/components/PaymentOptions/styles.js +9 -7
  42. package/_modules/themes/five/src/components/ProductOptionSubOption/styles.js +20 -14
  43. package/_modules/themes/five/src/components/ProfessionalFilter/index.js +23 -25
  44. package/_modules/themes/five/src/components/ProfessionalFilter/styles.js +6 -32
  45. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +38 -22
  46. package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +3 -9
  47. package/_modules/themes/five/src/components/ServiceForm/index.js +10 -4
  48. package/_modules/themes/five/src/components/ServiceForm/styles.js +23 -25
  49. package/_modules/themes/five/src/components/SignUpForm/index.js +6 -0
  50. package/_modules/themes/five/src/components/SingleOrderCard/index.js +22 -16
  51. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/index.js +13 -2
  52. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +73 -51
  53. package/_modules/themes/five/src/components/SingleProfessionalCard/index.js +23 -7
  54. package/_modules/themes/five/src/components/SingleProfessionalCard/styles.js +29 -10
  55. package/_modules/themes/five/src/components/Wallets/index.js +2 -1
  56. package/package.json +2 -2
  57. package/src/themes/five/src/components/BusinessBasicInformation/index.js +49 -35
  58. package/src/themes/five/src/components/BusinessBasicInformation/styles.js +26 -4
  59. package/src/themes/five/src/components/BusinessItemAccordion/index.js +1 -1
  60. package/src/themes/five/src/components/BusinessProductsCategories/index.js +8 -2
  61. package/src/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +2 -2
  62. package/src/themes/five/src/components/BusinessProductsListing/index.js +1 -0
  63. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +1 -1
  64. package/src/themes/five/src/components/Cart/index.js +44 -14
  65. package/src/themes/five/src/components/CartContent/index.js +1 -0
  66. package/src/themes/five/src/components/Checkout/index.js +67 -51
  67. package/src/themes/five/src/components/DriverTips/index.js +52 -40
  68. package/src/themes/five/src/components/GiftCard/GiftCardUI/index.js +59 -0
  69. package/src/themes/five/src/components/GiftCard/GiftCardUI/styles.js +41 -0
  70. package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +70 -0
  71. package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +52 -0
  72. package/src/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +122 -0
  73. package/src/themes/five/src/components/GiftCard/RedeemGiftCard/styles.js +41 -0
  74. package/src/themes/five/src/components/GiftCard/SendGiftCard/index.js +103 -0
  75. package/src/themes/five/src/components/GiftCard/SendGiftCard/styles.js +27 -0
  76. package/src/themes/five/src/components/HorizontalOrdersLayout/index.js +7 -4
  77. package/src/themes/five/src/components/HorizontalOrdersLayout/styles.js +0 -1
  78. package/src/themes/five/src/components/LoginForm/index.js +7 -0
  79. package/src/themes/five/src/components/OrderDetails/OrderEta.js +59 -0
  80. package/src/themes/five/src/components/OrderDetails/index.js +141 -133
  81. package/src/themes/five/src/components/OrderDetails/styles.js +0 -1
  82. package/src/themes/five/src/components/OrderItAgain/styles.js +6 -6
  83. package/src/themes/five/src/components/OrderProgress/index.js +3 -12
  84. package/src/themes/five/src/components/PaymentOptions/index.js +26 -5
  85. package/src/themes/five/src/components/PaymentOptions/styles.js +4 -0
  86. package/src/themes/five/src/components/ProductOptionSubOption/styles.js +24 -4
  87. package/src/themes/five/src/components/ProfessionalFilter/index.js +18 -30
  88. package/src/themes/five/src/components/ProfessionalFilter/styles.js +1 -57
  89. package/src/themes/five/src/components/RenderProductsLayout/index.js +33 -17
  90. package/src/themes/five/src/components/RenderProductsLayout/styles.js +0 -18
  91. package/src/themes/five/src/components/ServiceForm/index.js +11 -5
  92. package/src/themes/five/src/components/ServiceForm/styles.js +1 -9
  93. package/src/themes/five/src/components/SignUpForm/index.js +7 -0
  94. package/src/themes/five/src/components/SingleOrderCard/index.js +43 -26
  95. package/src/themes/five/src/components/SingleProductCard/layouts/original/index.js +12 -2
  96. package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +51 -4
  97. package/src/themes/five/src/components/SingleProfessionalCard/index.js +17 -6
  98. package/src/themes/five/src/components/SingleProfessionalCard/styles.js +33 -6
  99. package/src/themes/five/src/components/Wallets/index.js +2 -1
@@ -0,0 +1,59 @@
1
+ import React, { useState } from 'react'
2
+ import { useLanguage } from 'ordering-components-external'
3
+ import { Modal } from '../../Modal'
4
+ import { Button } from '../../../styles/Buttons'
5
+ import BsGift from '@meronex/icons/bs/BsGift'
6
+ import { PurchaseGiftCard } from '../PurchaseGiftCard'
7
+ import { RedeemGiftCard } from '../RedeemGiftCard'
8
+
9
+ import {
10
+ Container,
11
+ TitleWrapper,
12
+ ActionWrapper
13
+ } from './styles'
14
+
15
+ export const GiftCardUI = (props) => {
16
+ const [, t] = useLanguage()
17
+ const [openModal, setOpenModal] = useState(null)
18
+
19
+ return (
20
+ <Container>
21
+ <TitleWrapper>
22
+ <h1>{t('GIFT_CARD', 'Gift card')}</h1>
23
+ <BsGift />
24
+ </TitleWrapper>
25
+ <ActionWrapper>
26
+ <Button
27
+ color='primary'
28
+ onClick={() => setOpenModal('purchase')}
29
+ >
30
+ {t('PURCHASE_GIFT_CARD', 'Purchase gift card')}
31
+ </Button>
32
+ <Button
33
+ outline
34
+ color='primary'
35
+ className='light'
36
+ onClick={() => setOpenModal('redeem')}
37
+ >
38
+ {t('REDEEM_GIFT_CARD', 'Redeem gift card')}
39
+ </Button>
40
+ </ActionWrapper>
41
+ <Modal
42
+ width='700px'
43
+ open={openModal === 'purchase'}
44
+ onClose={() => setOpenModal(null)}
45
+ >
46
+ <PurchaseGiftCard />
47
+ </Modal>
48
+ <Modal
49
+ width='700px'
50
+ open={openModal === 'redeem'}
51
+ onClose={() => setOpenModal(null)}
52
+ >
53
+ <RedeemGiftCard
54
+ onClose={() => setOpenModal(null)}
55
+ />
56
+ </Modal>
57
+ </Container>
58
+ )
59
+ }
@@ -0,0 +1,41 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ margin-top: 50px;
5
+ margin-bottom: 60px;
6
+ `
7
+ export const TitleWrapper = styled.div`
8
+ display: flex;
9
+ align-items: center;
10
+ margin-bottom: 20px;
11
+
12
+ h1 {
13
+ margin: 0;
14
+ font-size: 20px;
15
+ font-weight: 600;
16
+ }
17
+ svg {
18
+ margin: 0 10px;
19
+ }
20
+ `
21
+ export const ActionWrapper = styled.div`
22
+ display: flex;
23
+ > button {
24
+ height: 44px;
25
+ &:first-child {
26
+ ${props => props.theme?.rtl ? css`
27
+ margin-left: 20px;
28
+ ` : css`
29
+ margin-right: 20px;
30
+ `}
31
+ }
32
+ &.light {
33
+ border: 1px solid ${props => props.theme.colors.primaryContrast};
34
+ background: ${props => props.theme.colors.primaryContrast};
35
+ margin: 0 20px;
36
+ &:hover {
37
+ background: ${props => props.theme.colors.primary};
38
+ }
39
+ }
40
+ }
41
+ `
@@ -0,0 +1,70 @@
1
+ import React from 'react'
2
+ import { useLanguage, PurchaseGiftCard as PurchaseGiftCardController } from 'ordering-components-external'
3
+ import Skeleton from 'react-loading-skeleton'
4
+ import { Button } from '../../../styles/Buttons'
5
+ import RiRadioButtonFill from '@meronex/icons/ri/RiRadioButtonFill'
6
+ import MdRadioButtonUnchecked from '@meronex/icons/md/MdRadioButtonUnchecked'
7
+
8
+ import {
9
+ Container,
10
+ GiftCardsListContainer,
11
+ GiftCardItem,
12
+ IconControl
13
+ } from './styles'
14
+
15
+ const PurchaseGiftCardUI = (props) => {
16
+ const {
17
+ productsListState,
18
+ selectedProduct,
19
+ setSelectedProduct,
20
+ handleAccept
21
+ } = props
22
+ const [, t] = useLanguage()
23
+
24
+ return (
25
+ <Container>
26
+ <h2>{t('PURCHASE_GIFT_CARD', 'Purchase gift card')}</h2>
27
+ <p>{t('SELECT_ONE_OPTION', 'Select one option')}</p>
28
+ <GiftCardsListContainer>
29
+ {productsListState.loading && (
30
+ [...Array(5).keys()].map(i => (
31
+ <GiftCardItem key={i}>
32
+ <Skeleton width={150} />
33
+ </GiftCardItem>
34
+ ))
35
+ )}
36
+ {productsListState.products.map(product => (
37
+ <GiftCardItem
38
+ key={product.id}
39
+ onClick={() => setSelectedProduct(product)}
40
+ >
41
+ <IconControl>
42
+ {selectedProduct?.id === product.id ? (
43
+ <RiRadioButtonFill />
44
+ ) : (
45
+ <MdRadioButtonUnchecked disabled />
46
+ )}
47
+ </IconControl>
48
+ <span>{product.name}</span>
49
+ </GiftCardItem>
50
+ ))}
51
+ </GiftCardsListContainer>
52
+ <Button
53
+ type='button'
54
+ color='primary'
55
+ disabled={!selectedProduct}
56
+ onClick={() => handleAccept()}
57
+ >
58
+ {t('ACCEPT', 'Accept')}
59
+ </Button>
60
+ </Container>
61
+ )
62
+ }
63
+
64
+ export const PurchaseGiftCard = (props) => {
65
+ const purchaseGiftCardProps = {
66
+ ...props,
67
+ UIComponent: PurchaseGiftCardUI
68
+ }
69
+ return <PurchaseGiftCardController {...purchaseGiftCardProps} />
70
+ }
@@ -0,0 +1,52 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ display: flex;
5
+ flex-direction: column;
6
+
7
+ h2 {
8
+ font-size: 24px;
9
+ font-weight: 600;
10
+ text-align: center;
11
+ margin-top: 0;
12
+ margin-bottom: 24px;
13
+ }
14
+ > p {
15
+ font-size: 16px;
16
+ line-height: 24px;
17
+ margin-top: 0;
18
+ }
19
+ > button {
20
+ height: 44px;
21
+ }
22
+ `
23
+ export const GiftCardsListContainer = styled.div`
24
+ margin-bottom: 40px;
25
+ `
26
+ export const GiftCardItem = styled.div`
27
+ cursor: pointer;
28
+ display: flex;
29
+ align-items: center;
30
+ border-bottom: 1px solid ${props => props.theme.colors.gray200};
31
+ padding: 20px 0;
32
+
33
+ > span {
34
+ font-size: 16px;
35
+ }
36
+ `
37
+ export const IconControl = styled.div`
38
+ display: flex;
39
+ color: ${props => props.theme.colors.primary};
40
+ margin-right: 40px;
41
+ ${props => props.theme?.rtl && css`
42
+ margin-left: 40px;
43
+ margin-right: 0px;
44
+ `}
45
+ svg {
46
+ font-size: 24px;
47
+ }
48
+
49
+ svg[disabled] {
50
+ color: ${props => props.theme.colors.lightGray};
51
+ }
52
+ `
@@ -0,0 +1,122 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useLanguage, useUtils, RedeemGiftCard as RedeemGiftCardController } from 'ordering-components-external'
3
+ import { useForm } from 'react-hook-form'
4
+ import { Alert } from '../../Confirm'
5
+ import { Button } from '../../../styles/Buttons'
6
+ import { Input } from '../../../styles/Inputs'
7
+
8
+ import {
9
+ Container,
10
+ FormContainer,
11
+ FormController,
12
+ GiftCardInfoContainer
13
+ } from './styles'
14
+
15
+ const RedeemGiftCardUI = (props) => {
16
+ const {
17
+ actionState,
18
+ redeemedGiftCard,
19
+ handleApply,
20
+ onClose
21
+ } = props
22
+
23
+ const [, t] = useLanguage()
24
+ const [{ parsePrice }] = useUtils()
25
+ const { register, handleSubmit, errors } = useForm()
26
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
27
+
28
+ const onSubmit = (values) => {
29
+ handleApply(values)
30
+ }
31
+
32
+ useEffect(() => {
33
+ if (Object.keys(errors).length > 0) {
34
+ setAlertState({
35
+ open: true,
36
+ content: Object.values(errors).map(error => error.message)
37
+ })
38
+ }
39
+ }, [errors])
40
+
41
+ useEffect(() => {
42
+ if (!actionState.error) return
43
+ setAlertState({
44
+ open: true,
45
+ content: actionState.error
46
+ })
47
+ }, [actionState.error])
48
+
49
+ return (
50
+ <Container>
51
+ {!redeemedGiftCard ? (
52
+ <FormContainer onSubmit={handleSubmit(onSubmit)}>
53
+ <h2>{t('REDEEM_GIFT_CARD', 'Redeem a gift card')}</h2>
54
+ <FormController>
55
+ <label>{t('GIFT_CARD_CODE', 'Gift card code')}</label>
56
+ <Input
57
+ name='code'
58
+ placeholder='0000 0000'
59
+ type='text'
60
+ ref={register({
61
+ required: t('VALIDATION_ERROR_REQUIRED', 'Code is required').replace('_attribute_', t('CODE', 'Code'))
62
+ })}
63
+ autoComplete='off'
64
+ />
65
+ </FormController>
66
+ <FormController>
67
+ <label>{t('PASSWORD', 'Password')}</label>
68
+ <Input
69
+ name='password'
70
+ type='password'
71
+ ref={register({
72
+ required: t('VALIDATION_ERROR_REQUIRED', 'Password is required').replace('_attribute_', t('PASSWORD', 'Password'))
73
+ })}
74
+ autoComplete='new-password'
75
+ />
76
+ </FormController>
77
+ <Button
78
+ type='submit'
79
+ color='primary'
80
+ disabled={actionState.loading}
81
+ >
82
+ {actionState?.loading ? t('LOADING', 'Loading') : t('APPLY_TO_YOUR_BALANCE', 'Apply to your balance')}
83
+ </Button>
84
+ <Alert
85
+ title={t('ERROR', 'Error')}
86
+ content={alertState.content}
87
+ acceptText={t('ACCEPT', 'Accept')}
88
+ open={alertState.open}
89
+ onClose={() => setAlertState({ open: false, content: [] })}
90
+ onAccept={() => setAlertState({ open: false, content: [] })}
91
+ closeOnBackdrop={false}
92
+ />
93
+ </FormContainer>
94
+ ) : (
95
+ <>
96
+ <h2>{t('GIFT_CARD', 'Gift card')}</h2>
97
+ <GiftCardInfoContainer>
98
+ <p>{t('TYPE', 'Type')}: {redeemedGiftCard?.type}</p>
99
+ <p>{t('AMOUNT', 'Amount')}: {parsePrice(redeemedGiftCard?.amount)}</p>
100
+ <p>{t('FROM', 'From')}: {redeemedGiftCard?.receiver?.name} {redeemedGiftCard?.receiver?.lastname}</p>
101
+ <p>{t('TITLE', 'Title')}: {redeemedGiftCard?.title}</p>
102
+ <p>{t('MESSAGES', 'Messages')}: {redeemedGiftCard?.message}</p>
103
+ <Button
104
+ color='primary'
105
+ onClick={() => onClose()}
106
+ >
107
+ {t('OK', 'Ok')}
108
+ </Button>
109
+ </GiftCardInfoContainer>
110
+ </>
111
+ )}
112
+ </Container>
113
+ )
114
+ }
115
+
116
+ export const RedeemGiftCard = (props) => {
117
+ const redeemGiftCardProps = {
118
+ ...props,
119
+ UIComponent: RedeemGiftCardUI
120
+ }
121
+ return <RedeemGiftCardController {...redeemGiftCardProps} />
122
+ }
@@ -0,0 +1,41 @@
1
+ import styled from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ h2 {
5
+ font-size: 24px;
6
+ font-weight: 600;
7
+ text-align: center;
8
+ margin-top: 0;
9
+ margin-bottom: 48px;
10
+ }
11
+
12
+ p {
13
+ font-size: 14px;
14
+ line-height: 18px;
15
+ margin: 6px 0;
16
+ color: ${props => props.theme.colors.darkGray};
17
+ }
18
+
19
+ button {
20
+ height: 44px;
21
+ margin-top: 50px;
22
+ }
23
+ `
24
+ export const FormContainer = styled.form`
25
+ display: flex;
26
+ flex-direction: column;
27
+ `
28
+ export const FormController = styled.div`
29
+ display: flex;
30
+ flex-direction: column;
31
+ margin-bottom: 28px;
32
+
33
+ label {
34
+ margin-bottom: 10px;
35
+ font-size: 14px;
36
+ }
37
+ `
38
+ export const GiftCardInfoContainer = styled.div`
39
+ display: flex;
40
+ flex-direction: column;
41
+ `
@@ -0,0 +1,103 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useLanguage, SendGiftCard as SendGiftCardController } from 'ordering-components-external'
3
+ import { useForm } from 'react-hook-form'
4
+ import { Alert } from '../../Confirm'
5
+ import { Button } from '../../../styles/Buttons'
6
+ import { Input, TextArea } from '../../../styles/Inputs'
7
+ import {
8
+ Container,
9
+ FormController
10
+ } from './styles'
11
+
12
+ const SendGiftCardUI = (props) => {
13
+ const {
14
+ actionState,
15
+ handleSendGiftCard
16
+ } = props
17
+ const [, t] = useLanguage()
18
+ const { register, handleSubmit, errors } = useForm()
19
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
20
+
21
+ const onSubmit = (values) => {
22
+ handleSendGiftCard(values)
23
+ }
24
+
25
+ useEffect(() => {
26
+ if (Object.keys(errors).length > 0) {
27
+ setAlertState({
28
+ open: true,
29
+ content: Object.values(errors).map(error => error.message)
30
+ })
31
+ }
32
+ }, [errors])
33
+
34
+ return (
35
+ <Container onSubmit={handleSubmit(onSubmit)}>
36
+ <h2>{t('GIFT_CARD_DETAILS', 'Gift Card details')}</h2>
37
+ <FormController>
38
+ <label>{t('TO', 'To')}</label>
39
+ <Input
40
+ name='email'
41
+ placeholder={t('ENTER_AN_EMAIL', 'Enter an email')}
42
+ ref={register({
43
+ required: t('VALIDATION_ERROR_REQUIRED', 'To email is required').replace('_attribute_', t('EMAIL', 'EMail'))
44
+ })}
45
+ autoComplete='off'
46
+ />
47
+ </FormController>
48
+ <FormController>
49
+ <label>{t('FROM', 'From')}</label>
50
+ <Input
51
+ name='user_name'
52
+ ref={register()}
53
+ placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
54
+ autoComplete='off'
55
+ />
56
+ </FormController>
57
+ <FormController>
58
+ <label>{t('TITLE', 'Title')}</label>
59
+ <Input
60
+ name='title'
61
+ ref={register()}
62
+ placeholder={t('TITLE', 'Title')}
63
+ autoComplete='off'
64
+ />
65
+ </FormController>
66
+ <FormController>
67
+ <label>{t('MESSAGES', 'Messages')}</label>
68
+ <TextArea
69
+ name='message'
70
+ ref={register()}
71
+ rows={5}
72
+ placeholder={t('TYPE_YOUR_MESSAGE_HERE', 'Type your message here')}
73
+ autoComplete='off'
74
+ />
75
+ </FormController>
76
+ <Button
77
+ type='submit'
78
+ color='primary'
79
+ disabled={actionState.loading}
80
+ >
81
+ {actionState?.loading ? t('LOADING', 'Loading') : t('SEND_GIFT_CARD', 'Send gift card')}
82
+ </Button>
83
+ <Alert
84
+ title={t('ERROR', 'Error')}
85
+ content={alertState.content}
86
+ acceptText={t('ACCEPT', 'Accept')}
87
+ open={alertState.open}
88
+ onClose={() => setAlertState({ open: false, content: [] })}
89
+ onAccept={() => setAlertState({ open: false, content: [] })}
90
+ closeOnBackdrop={false}
91
+ />
92
+ </Container>
93
+ )
94
+ }
95
+
96
+ export const SendGiftCard = (props) => {
97
+ const sendGiftCardProps = {
98
+ ...props,
99
+ showToastMsg: true,
100
+ UIComponent: SendGiftCardUI
101
+ }
102
+ return <SendGiftCardController {...sendGiftCardProps} />
103
+ }
@@ -0,0 +1,27 @@
1
+ import styled from 'styled-components'
2
+
3
+ export const Container = styled.form`
4
+ box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.12);
5
+ border-radius: 7.6px;
6
+ padding: 25px 20px;
7
+ h2 {
8
+ font-size: 20px;
9
+ font-weight: 600;
10
+ margin-top: 0;
11
+ margin-bottom: 32px;
12
+ }
13
+ > button {
14
+ height: 44px;
15
+ margin-top: 30px;
16
+ }
17
+ `
18
+ export const FormController = styled.div`
19
+ display: flex;
20
+ flex-direction: column;
21
+ margin-bottom: 28px;
22
+
23
+ label {
24
+ margin-bottom: 10px;
25
+ font-size: 14px;
26
+ }
27
+ `
@@ -28,11 +28,14 @@ export const HorizontalOrdersLayout = (props) => {
28
28
 
29
29
  const [, t] = useLanguage()
30
30
 
31
- const ordersToShow = businessesIds
31
+ const ordersToShow = businessesIds && isCustomerMode
32
32
  ? orders.filter(order =>
33
- businessesIds?.includes(order?.business_id) ||
34
- JSON.stringify(businessesIds.sort((a, b) => a - b)) === JSON.stringify(order?.business?.map(business => business?.id).sort((a, b) => a - b)))
35
- : orders
33
+ businessesIds?.includes(order?.business_id))
34
+ : businessesIds
35
+ ? orders.filter(order =>
36
+ businessesIds?.includes(order?.business_id) ||
37
+ JSON.stringify(businessesIds.sort((a, b) => a - b)) === JSON.stringify(order?.business?.map(business => business?.id).sort((a, b) => a - b)))
38
+ : orders
36
39
 
37
40
  const notOrders = isProducts || isBusiness
38
41
 
@@ -21,7 +21,6 @@ export const CardWrapper = styled.div`
21
21
  `
22
22
  export const CardsContainer = styled.div`
23
23
  display: flex;
24
- justify-content: space-between;
25
24
  overflow-x: auto;
26
25
  `
27
26
 
@@ -346,6 +346,12 @@ const LoginFormUI = (props) => {
346
346
  }
347
347
  }, [recaptchaConfig])
348
348
 
349
+ const preventWhiteSpaceOnKeyDown = (e) => {
350
+ if (e.key === " ") {
351
+ e.preventDefault()
352
+ }
353
+ }
354
+
349
355
  return (
350
356
  <>
351
357
  {props.beforeElements?.map((BeforeElement, i) => (
@@ -473,6 +479,7 @@ const LoginFormUI = (props) => {
473
479
  : null,
474
480
  pattern: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i
475
481
  })}
482
+ onKeyDown={preventWhiteSpaceOnKeyDown}
476
483
  onChange={handleChangeInputEmail}
477
484
  autoComplete='on'
478
485
  isError={formMethods.errors?.email}
@@ -0,0 +1,59 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useUtils } from 'ordering-components-external'
3
+ import moment from 'moment'
4
+
5
+ export const OrderEta = (props) => {
6
+ const {
7
+ order,
8
+ outputFormat
9
+ } = props
10
+
11
+ const [{ parseDate }] = useUtils()
12
+ const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
13
+
14
+ const getEstimatedDeliveryTime = () => {
15
+ let _estimatedTime
16
+ let totalEta = 0
17
+ const _delivery = order?.delivery_datetime_utc
18
+ ? parseDate(order?.delivery_datetime_utc)
19
+ : parseDate(order?.delivery_datetime)
20
+ if (order?.eta_current_status_time) {
21
+ const currentStatueEta = order?.eta_current_status_time
22
+ totalEta += currentStatueEta
23
+ let nextStatusTimes = 0
24
+ if (order?.eta_next_status_times) {
25
+ Object.keys(order.eta_next_status_times).map(key => {
26
+ if (!key.includes('status_penalty')) {
27
+ nextStatusTimes += order.eta_next_status_times[key]
28
+ }
29
+ })
30
+ }
31
+
32
+ totalEta += nextStatusTimes
33
+
34
+ const diffTimeAsSeconds = moment.utc(order?.reporting_data?.at[`status:${order.status}`]).add(order?.eta_current_status_time, 'minutes').diff(moment().utc(), 'seconds')
35
+ const diffTimeAsMinutes = Math.ceil(diffTimeAsSeconds / 60)
36
+ if (diffTimeAsMinutes <= 0) {
37
+ totalEta += (Math.floor(Math.abs(diffTimeAsMinutes / order?.eta_current_status_time) + 1) * order?.eta_current_status_penalty_time)
38
+ }
39
+ _estimatedTime = parseDate(moment(_delivery).add(totalEta, 'minutes'))
40
+ } else {
41
+ _estimatedTime = parseDate(moment(_delivery).add(order?.eta_time, 'minutes'))
42
+ }
43
+ setEstimatedDeliveryTime(_estimatedTime)
44
+ }
45
+
46
+ useEffect(() => {
47
+ getEstimatedDeliveryTime()
48
+ const interval = setInterval(() => {
49
+ getEstimatedDeliveryTime()
50
+ }, 1000)
51
+ return () => clearInterval(interval)
52
+ }, [order])
53
+
54
+ return (
55
+ <>
56
+ {!outputFormat ? estimatedDeliveryTime : moment(estimatedDeliveryTime).format(outputFormat)}
57
+ </>
58
+ )
59
+ }