ordering-ui-external 10.4.1 → 10.5.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 (73) hide show
  1. package/_bundles/{0.ordering-ui.62d46eec3c210c5257aa.js → 0.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
  2. package/_bundles/{1.ordering-ui.62d46eec3c210c5257aa.js → 1.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
  3. package/_bundles/{2.ordering-ui.62d46eec3c210c5257aa.js → 2.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
  4. package/_bundles/{4.ordering-ui.62d46eec3c210c5257aa.js → 4.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
  5. package/_bundles/{5.ordering-ui.62d46eec3c210c5257aa.js → 5.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
  6. package/_bundles/{6.ordering-ui.62d46eec3c210c5257aa.js → 6.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
  7. package/_bundles/{7.ordering-ui.62d46eec3c210c5257aa.js → 7.ordering-ui.cc1d13aa04732fde3671.js} +2 -2
  8. package/_bundles/{8.ordering-ui.62d46eec3c210c5257aa.js → 8.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
  9. package/_bundles/{9.ordering-ui.62d46eec3c210c5257aa.js → 9.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
  10. package/_bundles/ordering-ui.cc1d13aa04732fde3671.js +2 -0
  11. package/_modules/themes/callcenterOriginal/src/components/Orders/DeliveriesManager/index.js +4 -2
  12. package/_modules/themes/callcenterOriginal/src/components/Orders/OrdersDashboardControls/index.js +3 -1
  13. package/_modules/themes/callcenterOriginal/src/components/Orders/OrdersManager/index.js +2 -0
  14. package/_modules/themes/five/src/components/BusinessItemAccordion/index.js +5 -2
  15. package/_modules/themes/five/src/components/BusinessItemAccordion/styles.js +25 -19
  16. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +2 -0
  17. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +133 -31
  18. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +37 -3
  19. package/_modules/themes/five/src/components/Cart/index.js +10 -6
  20. package/_modules/themes/five/src/components/Checkout/index.js +67 -22
  21. package/_modules/themes/five/src/components/GiftCard/GiftCardOrdersList/index.js +53 -0
  22. package/_modules/themes/five/src/components/GiftCard/GiftCardOrdersList/styles.js +16 -0
  23. package/_modules/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/index.js +69 -0
  24. package/_modules/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/styles.js +16 -0
  25. package/_modules/themes/five/src/components/GiftCard/SingleGiftCard/index.js +90 -0
  26. package/_modules/themes/five/src/components/GiftCard/SingleGiftCard/styles.js +43 -0
  27. package/_modules/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.js +75 -0
  28. package/_modules/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.js +19 -0
  29. package/_modules/themes/five/src/components/MyOrders/index.js +6 -1
  30. package/_modules/themes/five/src/components/OrderProgress/index.js +1 -1
  31. package/_modules/themes/five/src/components/OrdersOption/index.js +1 -0
  32. package/_modules/themes/five/src/components/PhoneAutocomplete/index.js +165 -31
  33. package/_modules/themes/five/src/components/PhoneAutocomplete/styles.js +53 -9
  34. package/_modules/themes/five/src/components/ProductForm/index.js +1 -0
  35. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +1 -1
  36. package/_modules/themes/five/src/components/UserFormDetails/index.js +5 -17
  37. package/_modules/themes/five/src/components/UserFormDetails/styles.js +3 -7
  38. package/index-template.js +9 -1
  39. package/package.json +2 -2
  40. package/src/themes/callcenterOriginal/src/components/Orders/DeliveriesManager/index.js +3 -1
  41. package/src/themes/callcenterOriginal/src/components/Orders/OrdersDashboardControls/index.js +5 -1
  42. package/src/themes/callcenterOriginal/src/components/Orders/OrdersManager/index.js +2 -0
  43. package/src/themes/five/src/components/BusinessItemAccordion/index.js +2 -2
  44. package/src/themes/five/src/components/BusinessItemAccordion/styles.js +8 -7
  45. package/src/themes/five/src/components/BusinessProductsListing/index.js +2 -0
  46. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +156 -36
  47. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +66 -0
  48. package/src/themes/five/src/components/Cart/index.js +7 -4
  49. package/src/themes/five/src/components/Checkout/index.js +61 -35
  50. package/src/themes/five/src/components/GiftCard/GiftCardOrdersList/index.js +50 -0
  51. package/src/themes/five/src/components/GiftCard/GiftCardOrdersList/styles.js +34 -0
  52. package/src/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/index.js +75 -0
  53. package/src/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/styles.js +29 -0
  54. package/src/themes/five/src/components/GiftCard/SingleGiftCard/index.js +79 -0
  55. package/src/themes/five/src/components/GiftCard/SingleGiftCard/styles.js +79 -0
  56. package/src/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.js +72 -0
  57. package/src/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.js +31 -0
  58. package/src/themes/five/src/components/MyOrders/index.js +6 -1
  59. package/src/themes/five/src/components/OrderProgress/index.js +1 -1
  60. package/src/themes/five/src/components/OrdersOption/index.js +1 -0
  61. package/src/themes/five/src/components/PhoneAutocomplete/index.js +195 -46
  62. package/src/themes/five/src/components/PhoneAutocomplete/styles.js +106 -10
  63. package/src/themes/five/src/components/ProductForm/index.js +1 -0
  64. package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +1 -1
  65. package/src/themes/five/src/components/UserFormDetails/index.js +6 -27
  66. package/src/themes/five/src/components/UserFormDetails/styles.js +0 -16
  67. package/template/assets/images/delivery.svg +11 -0
  68. package/template/assets/images/phone-hero-callcenter.png +0 -0
  69. package/template/assets/images/phone.svg +11 -0
  70. package/template/assets/images/pickup.svg +17 -0
  71. package/_bundles/ordering-ui.62d46eec3c210c5257aa.js +0 -2
  72. /package/_bundles/{7.ordering-ui.62d46eec3c210c5257aa.js.LICENSE.txt → 7.ordering-ui.cc1d13aa04732fde3671.js.LICENSE.txt} +0 -0
  73. /package/_bundles/{ordering-ui.62d46eec3c210c5257aa.js.LICENSE.txt → ordering-ui.cc1d13aa04732fde3671.js.LICENSE.txt} +0 -0
@@ -0,0 +1,75 @@
1
+ import React, { useEffect } from 'react'
2
+ import { GiftCardOrdersList as GiftCardOrdersListController } from 'ordering-components-external'
3
+ import Skeleton from 'react-loading-skeleton'
4
+ import { AutoScroll } from '../../AutoScroll'
5
+ import { SingleGiftCard } from '../SingleGiftCard'
6
+ import { Pagination } from '../../Pagination'
7
+ import {
8
+ ProductsListContainer,
9
+ ProductsList,
10
+ PaginationWrapper
11
+ } from './styles'
12
+
13
+ const HorizontalGiftCardOrdersLayoutUI = (props) => {
14
+ const {
15
+ giftCards,
16
+ paginationProps,
17
+ goToPage,
18
+ title,
19
+ setIsEmpty,
20
+ scrollId
21
+ } = props
22
+
23
+ useEffect(() => {
24
+ if (giftCards.loading) return
25
+ if (giftCards.list?.length === 0) setIsEmpty(true)
26
+ }, [giftCards])
27
+
28
+ return (
29
+ <>
30
+ {giftCards.loading
31
+ ? <Skeleton width={100} height={24} />
32
+ : giftCards.list?.length > 0 && <h2>{title}</h2>}
33
+ <ProductsListContainer>
34
+ <ProductsList>
35
+ <AutoScroll scrollId={scrollId}>
36
+ {giftCards.loading ? (
37
+ [...Array(10).keys()].map(i => (
38
+ <SingleGiftCard
39
+ isSkeleton
40
+ key={i}
41
+ />
42
+ ))
43
+ ) : (
44
+ <>
45
+ {giftCards.list.map(card => (
46
+ <SingleGiftCard
47
+ key={card.id}
48
+ card={card}
49
+ />
50
+ ))}
51
+ </>
52
+ )}
53
+ </AutoScroll>
54
+ </ProductsList>
55
+ </ProductsListContainer>
56
+ {giftCards.list?.length > 0 && Math.ceil(paginationProps?.totalPages) > 1 && (
57
+ <PaginationWrapper>
58
+ <Pagination
59
+ currentPage={paginationProps.currentPage}
60
+ totalPages={Math.ceil(paginationProps?.totalPages)}
61
+ handleChangePage={goToPage}
62
+ />
63
+ </PaginationWrapper>
64
+ )}
65
+ </>
66
+ )
67
+ }
68
+
69
+ export const HorizontalGiftCardOrdersLayout = (props) => {
70
+ const giftCardsProps = {
71
+ ...props,
72
+ UIComponent: HorizontalGiftCardOrdersLayoutUI
73
+ }
74
+ return <GiftCardOrdersListController {...giftCardsProps} />
75
+ }
@@ -0,0 +1,29 @@
1
+ import styled from 'styled-components'
2
+
3
+ export const ProductsListContainer = styled.div`
4
+ margin-top: 10px;
5
+ display: flex;
6
+ overflow: scroll hidden;
7
+ `
8
+
9
+ export const ProductsList = styled.div`
10
+ display: flex;
11
+ box-sizing: border-box;
12
+
13
+ .product-card {
14
+ width: 270px;
15
+ max-width: 270px;
16
+ margin: 10px;
17
+ border: 1px solid #E9ECEF;
18
+ }
19
+
20
+ @media(min-width: 480px){
21
+ .product-card {
22
+ width: 400px;
23
+ max-width: 400px;
24
+ }
25
+ }
26
+ `
27
+ export const PaginationWrapper = styled.div`
28
+ margin: 20px 0;
29
+ `
@@ -0,0 +1,79 @@
1
+ import React from 'react'
2
+ import { useLanguage, useUtils, useEvent } from 'ordering-components-external'
3
+ import Skeleton from 'react-loading-skeleton'
4
+ import { useTheme } from 'styled-components'
5
+ import BsDot from '@meronex/icons/bs/BsDot'
6
+
7
+ import {
8
+ CardContainer,
9
+ CardLogo,
10
+ CardInfo
11
+ } from './styles'
12
+
13
+ export const SingleGiftCard = (props) => {
14
+ const {
15
+ card,
16
+ isSkeleton
17
+ } = props
18
+
19
+ const theme = useTheme()
20
+ const [, t] = useLanguage()
21
+ const [events] = useEvent()
22
+ const [{ parsePrice, optimizeImage, parseDate }] = useUtils()
23
+
24
+ const getGiftCardStatus = (status) => {
25
+ switch (status) {
26
+ case 'pending':
27
+ return t('PENDING', 'Pending')
28
+ case 'activated':
29
+ return t('REDEEMED')
30
+ default:
31
+ return status
32
+ }
33
+ }
34
+
35
+ const handleClickGiftCardOrder = (card) => {
36
+ events.emit('go_to_page', { page: 'order_detail', params: { orderId: card.order_product?.order_id } })
37
+ }
38
+
39
+ return (
40
+ <CardContainer
41
+ className='product-card'
42
+ onClick={() => handleClickGiftCardOrder(card)}
43
+ >
44
+ {isSkeleton ? (
45
+ <Skeleton height={86} width={86} />
46
+ ) : (
47
+ <CardLogo
48
+ bgimage={optimizeImage(card?.order_product?.images || theme?.images?.dummies?.product, 'h_86,c_limit')}
49
+ />
50
+ )}
51
+ <CardInfo>
52
+ <div>
53
+ {isSkeleton ? (
54
+ <Skeleton height={16} width={100} />
55
+ ) : (
56
+ <span className='name'>{card?.order_product?.name}</span>
57
+ )}
58
+ {isSkeleton ? (
59
+ <Skeleton height={16} width={80} />
60
+ ) : (
61
+ <span>{parsePrice(card?.order_product?.price)}</span>
62
+ )}
63
+ </div>
64
+ {isSkeleton ? (
65
+ <p className='date'><Skeleton width={150} height={14} /></p>
66
+ ) : (
67
+ <p className='date'>
68
+ {t('ORDER_NUM', 'Order No.')} {card?.order_product?.order_id}<BsDot />{parseDate(card?.created_at)}
69
+ </p>
70
+ )}
71
+ {isSkeleton ? (
72
+ <p className='status'><Skeleton width={80} height={14} /></p>
73
+ ) : (
74
+ <p className='status'>{getGiftCardStatus(card?.status)}</p>
75
+ )}
76
+ </CardInfo>
77
+ </CardContainer>
78
+ )
79
+ }
@@ -0,0 +1,79 @@
1
+ import React from 'react'
2
+ import styled, { css } from 'styled-components'
3
+
4
+ export const CardContainer = styled.div`
5
+ background: ${props => props.theme.colors?.backgroundPage};
6
+ display: flex;
7
+ cursor: pointer;
8
+ padding: 10px;
9
+ border-radius: 7.6px;
10
+
11
+ &:hover {
12
+ box-shadow: rgb(0 0 0 / 20%) 0px 8px 24px;
13
+ }
14
+ `
15
+ const CardLogoStyled = styled.div`
16
+ box-sizing: border-box;
17
+ position: relative;
18
+ background-repeat: no-repeat, repeat;
19
+ background-size: cover;
20
+ background-position: center;
21
+ object-fit: cover;
22
+ height: 86px;
23
+ width: 86px;
24
+ min-width: 86px;
25
+ min-height: 86px;
26
+ border-radius: 8px;
27
+ box-shadow: 0px 1px 4px rgba(0,0,0,0.1);
28
+ `
29
+ export const CardLogo = (props) => {
30
+ const style = {}
31
+ if (props.bgimage) {
32
+ style.backgroundImage = `url(${props.bgimage})`
33
+ }
34
+ if (props.soldOut) {
35
+ style.filter = 'brightness(70%)'
36
+ }
37
+ return (
38
+ <CardLogoStyled {...props} style={style}>
39
+ {props.children}
40
+ </CardLogoStyled>
41
+ )
42
+ }
43
+
44
+ export const CardInfo = styled.div`
45
+ ${props => props.theme?.rtl ? css`
46
+ margin-right: 15px;
47
+ ` : css`
48
+ margin-left: 15px;
49
+ `}
50
+
51
+ flex: 1;
52
+ > div {
53
+ display: flex;
54
+ align-items: center;
55
+ justify-content: space-between;
56
+ font-size: 16px;
57
+ font-weight: 600;
58
+ span.name {
59
+ overflow: hidden;
60
+ text-overflow: ellipsis;
61
+ white-space: nowrap;
62
+ }
63
+ }
64
+
65
+ p.date {
66
+ font-size: 14px;
67
+ color: ${props => props.theme.colors.darkGray};
68
+ margin: 7px 0;
69
+ line-height: 24px;
70
+ display: flex;
71
+ align-items: center;
72
+ }
73
+ p.status {
74
+ font-size: 14px;
75
+ line-height: 24px;
76
+ color: ${props => props.theme.colors.primary};
77
+ margin: 0;
78
+ }
79
+ `
@@ -0,0 +1,72 @@
1
+ import React, { useEffect } from 'react'
2
+ import { useLanguage, GiftCardOrdersList as GiftCardOrdersListController } from 'ordering-components-external'
3
+ import Skeleton from 'react-loading-skeleton'
4
+ import { SingleGiftCard } from '../SingleGiftCard'
5
+ import { Button } from '../../../styles/Buttons'
6
+
7
+ import {
8
+ ProductsListContainer,
9
+ WrappButton,
10
+ SingleGiftCardWrapper
11
+ } from './styles'
12
+
13
+ const VerticalGiftCardOrdersLayoutUI = (props) => {
14
+ const {
15
+ giftCards,
16
+ paginationProps,
17
+ loadMoreOrders,
18
+ title,
19
+ setIsEmpty
20
+ } = props
21
+
22
+ const [, t] = useLanguage()
23
+
24
+ useEffect(() => {
25
+ if (giftCards.loading) return
26
+ if (giftCards.list?.length === 0) setIsEmpty(true)
27
+ }, [giftCards])
28
+
29
+ return (
30
+ <ProductsListContainer>
31
+ {giftCards.loading
32
+ ? <Skeleton width={100} height={24} />
33
+ : giftCards.list?.length > 0 && <h2>{title}</h2>}
34
+ {giftCards.list.map(card => (
35
+ <SingleGiftCardWrapper key={card.id}>
36
+ <SingleGiftCard
37
+ card={card}
38
+ />
39
+ </SingleGiftCardWrapper>
40
+ ))}
41
+ {giftCards.loading && (
42
+ [...Array(10).keys()].map(i => (
43
+ <SingleGiftCardWrapper key={i}>
44
+ <SingleGiftCard
45
+ isSkeleton
46
+ />
47
+ </SingleGiftCardWrapper>
48
+ ))
49
+ )}
50
+ {paginationProps.totalPages && paginationProps.currentPage < paginationProps.totalPages && (
51
+ <WrappButton>
52
+ <Button
53
+ outline
54
+ color='primary'
55
+ bgtransparent
56
+ onClick={loadMoreOrders}
57
+ >
58
+ {t('LOAD_MORE_ORDERS', 'Load more orders')}
59
+ </Button>
60
+ </WrappButton>
61
+ )}
62
+ </ProductsListContainer>
63
+ )
64
+ }
65
+
66
+ export const VerticalGiftCardOrdersLayout = (props) => {
67
+ const giftCardsProps = {
68
+ ...props,
69
+ UIComponent: VerticalGiftCardOrdersLayoutUI
70
+ }
71
+ return <GiftCardOrdersListController {...giftCardsProps} />
72
+ }
@@ -0,0 +1,31 @@
1
+ import styled from 'styled-components'
2
+ import { darken } from 'polished'
3
+
4
+ export const ProductsListContainer = styled.div`
5
+ margin-top: 10px;
6
+ `
7
+ export const SingleGiftCardWrapper = styled.div`
8
+ border-bottom: 1px solid #E9ECEF;
9
+ padding: 20px 0;
10
+ `
11
+ export const WrappButton = styled.div`
12
+ width: 80%;
13
+ display: flex;
14
+ justify-content: center;
15
+ margin: 20px auto;
16
+
17
+ button {
18
+ padding: 10px 0px;
19
+ width: 100%;
20
+ }
21
+
22
+ button:hover{
23
+ color: ${props => darken(0.07, props.theme.colors.primary)};
24
+ }
25
+
26
+ @media (min-width: 768px) {
27
+ button {
28
+ width: 60%;
29
+ }
30
+ }
31
+ `
@@ -2,6 +2,7 @@ import React, { useState } from 'react'
2
2
  import { useLanguage } from 'ordering-components-external'
3
3
  import { ProfileOptions } from '../../../../../components/UserProfileForm/ProfileOptions'
4
4
  import { OrdersOption } from '../OrdersOption'
5
+ import { GiftCardOrdersList } from '../GiftCard/GiftCardOrdersList'
5
6
  import { Button } from '../../styles/Buttons'
6
7
  import MdClose from '@meronex/icons/ios/MdClose'
7
8
  import { useHistory } from 'react-router-dom'
@@ -41,7 +42,8 @@ export const MyOrders = (props) => {
41
42
  const MyOrdersMenu = [
42
43
  { key: 'orders', value: t('ORDERS', 'Orders'), disabled: false },
43
44
  { key: 'business', value: t('BUSINESS', 'Business'), disabled: hideBusinessTab },
44
- { key: 'products', value: t('PRODUCTS', 'Products'), disabled: hideProductsTab }
45
+ { key: 'products', value: t('PRODUCTS', 'Products'), disabled: hideProductsTab },
46
+ { key: 'giftCards', value: t('GIFT_CARD', 'Gift card'), disabled: false }
45
47
  ]
46
48
 
47
49
  const notOrderOptions = ['business', 'products', 'professionals']
@@ -144,6 +146,9 @@ export const MyOrders = (props) => {
144
146
  onProductRedirect={onProductRedirect}
145
147
  />
146
148
  )}
149
+ {selectedOption === 'giftCards' && (
150
+ <GiftCardOrdersList />
151
+ )}
147
152
  </Container>
148
153
  {props.afterComponents?.map((AfterComponent, i) => (
149
154
  <AfterComponent key={i} {...props} />))}
@@ -133,7 +133,7 @@ const OrderProgressUI = (props) => {
133
133
 
134
134
  export const OrderProgress = (props) => {
135
135
  const propsToFetchBusiness = ['name', 'logo', 'slug', 'id']
136
- const propsToFetch = ['cart', 'business', 'status', 'id', 'uuid', 'cart_group_id', 'business_id', 'delivery_datetime', 'delivery_datetime_utc', 'total', 'summary']
136
+ const propsToFetch = ['cart', 'business', 'status', 'id', 'uuid', 'cart_group_id', 'business_id', 'delivery_datetime', 'delivery_datetime_utc', 'total', 'summary', 'eta_current_status_time', 'eta_previous_status_times', 'eta_time', 'delivered_in', 'prepared_in', 'eta_drive_time']
137
137
  const orderProgressProps = {
138
138
  ...props,
139
139
  UIComponent: OrderProgressUI,
@@ -365,6 +365,7 @@ export const OrdersOption = (props) => {
365
365
  const orderListProps = {
366
366
  ...props,
367
367
  UIComponent: OrdersOptionUI,
368
+ noGiftCardOrders: true,
368
369
  orderStatus: getAllOrders
369
370
  ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
370
371
  : props.activeOrders