ordering-ui-external 2.6.7 → 2.7.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 (112) hide show
  1. package/_bundles/0.ordering-ui.0a58ae9fc1a4bce64c6e.js +1 -0
  2. package/_bundles/{1.ordering-ui.fd1dc326de89a8eb39f9.js → 1.ordering-ui.0a58ae9fc1a4bce64c6e.js} +1 -1
  3. package/_bundles/4.ordering-ui.0a58ae9fc1a4bce64c6e.js +1 -0
  4. package/_bundles/{5.ordering-ui.fd1dc326de89a8eb39f9.js → 5.ordering-ui.0a58ae9fc1a4bce64c6e.js} +1 -1
  5. package/_bundles/{6.ordering-ui.fd1dc326de89a8eb39f9.js → 6.ordering-ui.0a58ae9fc1a4bce64c6e.js} +1 -1
  6. package/_bundles/{7.ordering-ui.fd1dc326de89a8eb39f9.js → 7.ordering-ui.0a58ae9fc1a4bce64c6e.js} +2 -2
  7. package/_bundles/ordering-ui.0a58ae9fc1a4bce64c6e.js +2 -0
  8. package/_modules/components/LanguageSelector/index.js +1 -0
  9. package/_modules/components/OrderTypeSelectorHeader/index.js +3 -1
  10. package/_modules/components/SmartAppBanner/index.js +5 -2
  11. package/_modules/contexts/ThemeContext/index.js +1 -1
  12. package/_modules/styles/Select/index.js +14 -2
  13. package/_modules/styles/Selects/index.js +11 -8
  14. package/_modules/themes/five/index.js +21 -0
  15. package/_modules/themes/five/src/components/BusinessBasicInformation/BusinessInfoComponent.js +168 -0
  16. package/_modules/themes/five/src/components/BusinessBasicInformation/SearchComponent.js +39 -0
  17. package/_modules/themes/five/src/components/BusinessBasicInformation/SocialNetWork.js +19 -0
  18. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +35 -156
  19. package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +45 -35
  20. package/_modules/themes/five/src/components/BusinessController/index.js +6 -2
  21. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +1 -1
  22. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +5 -4
  23. package/_modules/themes/five/src/components/CardForm/index.js +16 -3
  24. package/_modules/themes/five/src/components/CardForm/styles.js +13 -9
  25. package/_modules/themes/five/src/components/CardFormCustom/cardUtils.js +102 -0
  26. package/_modules/themes/five/src/components/CardFormCustom/index.js +148 -0
  27. package/_modules/themes/five/src/components/CardFormCustom/styles.js +16 -0
  28. package/_modules/themes/five/src/components/Cart/index.js +1 -1
  29. package/_modules/themes/five/src/components/CartPopover/styles.js +1 -1
  30. package/_modules/themes/five/src/components/Checkout/index.js +41 -27
  31. package/_modules/themes/five/src/components/Header/index.js +10 -4
  32. package/_modules/themes/five/src/components/LanguageSelector/index.js +4 -1
  33. package/_modules/themes/five/src/components/LoginForm/index.js +11 -8
  34. package/_modules/themes/five/src/components/Modal/styles.js +1 -1
  35. package/_modules/themes/five/src/components/OrderContextUI/index.js +13 -1
  36. package/_modules/themes/five/src/components/OrderDetails/OrderBillSection.js +1 -1
  37. package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +18 -8
  38. package/_modules/themes/five/src/components/OrderDetails/OrderHistory.js +7 -3
  39. package/_modules/themes/five/src/components/OrderDetails/index.js +4 -2
  40. package/_modules/themes/five/src/components/PaymentOptionCard/index.js +84 -0
  41. package/_modules/themes/five/src/components/PaymentOptionStripe/index.js +48 -22
  42. package/_modules/themes/five/src/components/PaymentOptionStripe/styles.js +3 -1
  43. package/_modules/themes/five/src/components/PaymentOptions/index.js +46 -24
  44. package/_modules/themes/five/src/components/ProductForm/styles.js +1 -1
  45. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +2 -2
  46. package/_modules/themes/five/src/components/SearchProducts/styles.js +1 -1
  47. package/_modules/themes/five/src/components/UserDetails/index.js +1 -1
  48. package/_modules/themes/five/src/components/UserPopover/styles.js +1 -1
  49. package/_modules/themes/five/src/styles/Select/index.js +4 -2
  50. package/_modules/themes/five/src/styles/Selects/index.js +7 -4
  51. package/_modules/themes/pwa/src/components/MomentPopover/styles.js +1 -1
  52. package/index.html +1 -1
  53. package/package.json +4 -2
  54. package/src/components/LanguageSelector/index.js +1 -0
  55. package/src/components/OrderTypeSelectorHeader/index.js +3 -1
  56. package/src/components/SmartAppBanner/index.js +4 -2
  57. package/src/contexts/ThemeContext/index.js +1 -1
  58. package/src/styles/Select/index.js +11 -2
  59. package/src/styles/Selects/index.js +1 -1
  60. package/src/themes/five/index.js +6 -0
  61. package/src/themes/five/src/components/BusinessBasicInformation/BusinessInfoComponent.js +230 -0
  62. package/src/themes/five/src/components/BusinessBasicInformation/SearchComponent.js +40 -0
  63. package/src/themes/five/src/components/BusinessBasicInformation/SocialNetWork.js +10 -0
  64. package/src/themes/five/src/components/BusinessBasicInformation/index.js +39 -247
  65. package/src/themes/five/src/components/BusinessBasicInformation/styles.js +14 -4
  66. package/src/themes/five/src/components/BusinessController/index.js +2 -2
  67. package/src/themes/five/src/components/BusinessProductsCategories/index.js +1 -1
  68. package/src/themes/five/src/components/BusinessProductsListing/index.js +5 -4
  69. package/src/themes/five/src/components/CardForm/index.js +25 -4
  70. package/src/themes/five/src/components/CardForm/styles.js +35 -0
  71. package/src/themes/five/src/components/CardFormCustom/cardUtils.js +111 -0
  72. package/src/themes/five/src/components/CardFormCustom/index.js +161 -0
  73. package/src/themes/five/src/components/CardFormCustom/styles.js +20 -0
  74. package/src/themes/five/src/components/Cart/index.js +1 -1
  75. package/src/themes/five/src/components/CartPopover/styles.js +1 -1
  76. package/src/themes/five/src/components/Checkout/index.js +42 -30
  77. package/src/themes/five/src/components/Header/index.js +9 -4
  78. package/src/themes/five/src/components/LanguageSelector/index.js +2 -1
  79. package/src/themes/five/src/components/LoginForm/index.js +6 -4
  80. package/src/themes/five/src/components/Modal/styles.js +1 -0
  81. package/src/themes/five/src/components/OrderContextUI/index.js +10 -3
  82. package/src/themes/five/src/components/OrderDetails/OrderBillSection.js +1 -1
  83. package/src/themes/five/src/components/OrderDetails/OrderEta.js +21 -9
  84. package/src/themes/five/src/components/OrderDetails/OrderHistory.js +4 -3
  85. package/src/themes/five/src/components/OrderDetails/index.js +1 -1
  86. package/src/themes/five/src/components/PaymentOptionCard/index.js +70 -0
  87. package/src/themes/five/src/components/PaymentOptionStripe/index.js +46 -20
  88. package/src/themes/five/src/components/PaymentOptionStripe/styles.js +6 -1
  89. package/src/themes/five/src/components/PaymentOptions/index.js +28 -3
  90. package/src/themes/five/src/components/ProductForm/index.js +0 -1
  91. package/src/themes/five/src/components/ProductForm/styles.js +1 -1
  92. package/src/themes/five/src/components/RenderProductsLayout/index.js +2 -2
  93. package/src/themes/five/src/components/SearchProducts/styles.js +1 -1
  94. package/src/themes/five/src/components/UserDetails/index.js +1 -1
  95. package/src/themes/five/src/components/UserPopover/styles.js +1 -1
  96. package/src/themes/five/src/styles/Select/index.js +3 -2
  97. package/src/themes/five/src/styles/Selects/index.js +1 -1
  98. package/src/themes/pwa/src/components/MomentPopover/styles.js +4 -1
  99. package/template/app.js +13 -7
  100. package/template/pages/BusinessProductsList/index.js +4 -3
  101. package/template/pages/BusinessesList/index.js +2 -1
  102. package/template/pages/Checkout/index.js +1 -0
  103. package/template/pages/MyOrders/index.js +1 -0
  104. package/template/theme.json +3 -1
  105. package/_bundles/0.ordering-ui.fd1dc326de89a8eb39f9.js +0 -1
  106. package/_bundles/4.ordering-ui.fd1dc326de89a8eb39f9.js +0 -1
  107. package/_bundles/ordering-ui.fd1dc326de89a8eb39f9.js +0 -2
  108. /package/_bundles/{2.ordering-ui.fd1dc326de89a8eb39f9.js → 2.ordering-ui.0a58ae9fc1a4bce64c6e.js} +0 -0
  109. /package/_bundles/{7.ordering-ui.fd1dc326de89a8eb39f9.js.LICENSE.txt → 7.ordering-ui.0a58ae9fc1a4bce64c6e.js.LICENSE.txt} +0 -0
  110. /package/_bundles/{8.ordering-ui.fd1dc326de89a8eb39f9.js → 8.ordering-ui.0a58ae9fc1a4bce64c6e.js} +0 -0
  111. /package/_bundles/{9.ordering-ui.fd1dc326de89a8eb39f9.js → 9.ordering-ui.0a58ae9fc1a4bce64c6e.js} +0 -0
  112. /package/_bundles/{ordering-ui.fd1dc326de89a8eb39f9.js.LICENSE.txt → ordering-ui.0a58ae9fc1a4bce64c6e.js.LICENSE.txt} +0 -0
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import { LanguageSelector as LanguageSelectorController } from 'ordering-components-external'
3
3
  import { Select } from '../../styles/Select'
4
4
  import { Container } from './styles'
@@ -40,6 +40,7 @@ const LanguageSelectorUI = (props) => {
40
40
  src={`http://purecatamphetamine.github.io/country-flag-icons/3x2/${transformLanguageToCountry(currentLanguage)}.svg`}
41
41
  />
42
42
  <Select
43
+ zIndex={20000}
43
44
  isHomeStyle
44
45
  options={languagesState?.loading ? defaultLanguages : _languages}
45
46
  defaultValue={languagesState?.loading ? defaultCurrentLanguage : currentLanguage}
@@ -11,7 +11,8 @@ import {
11
11
  useSession,
12
12
  useToast, ToastType,
13
13
  ReCaptcha,
14
- useApi
14
+ useApi,
15
+ useOptimizationLoad
15
16
  } from 'ordering-components-external'
16
17
  import { Alert } from '../Confirm'
17
18
  import { SpinnerLoader } from '../../../../../components/SpinnerLoader'
@@ -96,6 +97,7 @@ const LoginFormUI = (props) => {
96
97
  const theme = useTheme()
97
98
  const [, { showToast }] = useToast()
98
99
  const [{ configs }] = useConfig()
100
+ const [optimizationLoad] = useOptimizationLoad()
99
101
  const formMethods = useForm()
100
102
  const [recaptchaConfig] = useRecaptcha(enableReCaptcha)
101
103
  const [alertState, setAlertState] = useState({ open: false, content: [] })
@@ -118,9 +120,9 @@ const LoginFormUI = (props) => {
118
120
  scope: 'profile'
119
121
  }
120
122
 
121
- const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
122
- const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
123
- const appleLoginEnabled = configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
123
+ const googleLoginEnabled = optimizationLoad?.result?.configs?.google_login_enabled?.value === '1'
124
+ const facebookLoginEnabled = optimizationLoad?.result?.configs?.facebook_login_enabled?.value === '1'
125
+ const appleLoginEnabled = optimizationLoad?.result?.configs?.apple_login_enabled?.value === '1'
124
126
 
125
127
  const spoonityTitle = configs?.spoonity_title?.value
126
128
 
@@ -22,6 +22,7 @@ export const ModalDialog = styled.div`
22
22
  max-height: 100vh;
23
23
  overflow: auto;
24
24
  overflow-x: ${({ disableOverflowX }) => disableOverflowX ? 'hidden' : 'auto'};
25
+ z-index: 10001;
25
26
  @media (min-width: 769px) {
26
27
  width: ${({ width }) => width || '50%'};
27
28
  max-height: 90vh;
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { useLanguage, useOrder, useConfig, useSession } from 'ordering-components-external'
3
3
  import { MomentPopover } from '../../../../pwa/src/components/MomentPopover'
4
4
  import { OrderTypeSelectorHeader } from '../../../../../components/OrderTypeSelectorHeader'
@@ -13,6 +13,7 @@ import {
13
13
  FeatureItems,
14
14
  ItemInline
15
15
  } from './styles'
16
+ import { useWindowSize } from '../../../../../hooks/useWindowSize'
16
17
 
17
18
  export const OrderContextUI = (props) => {
18
19
  const { isCheckOut, setMapErrors, isCustomerMode, isBusinessList } = props
@@ -25,7 +26,7 @@ export const OrderContextUI = (props) => {
25
26
  const [openPopover, setOpenPopover] = useState({})
26
27
  const [modals, setModals] = useState({ listOpen: false, formOpen: false, citiesOpen: false })
27
28
  const [alertState, setAlertState] = useState({ open: false, content: [] })
28
-
29
+ const windowSize = useWindowSize()
29
30
  const userCustomer = JSON.parse(window.localStorage.getItem('user-customer'))
30
31
 
31
32
  const configTypes = configState?.configs?.order_types_allowed?.value.split('|').map(value => Number(value)) || []
@@ -66,6 +67,12 @@ export const OrderContextUI = (props) => {
66
67
  }
67
68
  }
68
69
 
70
+ useEffect(() => {
71
+ const handleCloseallPopovers = () => handleClosePopover('moment')
72
+ window.addEventListener('scroll', handleCloseallPopovers)
73
+ return () => window.removeEventListener('scroll', handleCloseallPopovers)
74
+ }, [])
75
+
69
76
  return (
70
77
  <>
71
78
  <Container isBusinessList={isBusinessList} hero={props.hideHero} isCheckOut={isCheckOut}>
@@ -78,7 +85,7 @@ export const OrderContextUI = (props) => {
78
85
  </AddressMenu>
79
86
  <FeatureItems>
80
87
  <ItemInline>
81
- <OrderTypeSelectorHeader configTypes={configTypes} />
88
+ <OrderTypeSelectorHeader configTypes={configTypes} autoCloseWhenScroll={windowSize.width < 576} />
82
89
  </ItemInline>
83
90
  {isPreOrderSetting && (
84
91
  <ItemInline>
@@ -175,7 +175,7 @@ export const OrderBillSection = (props) => {
175
175
  </tr>
176
176
  ))
177
177
  }
178
- {order?.summary?.delivery_price > 0 && (
178
+ {typeof order?.summary?.delivery_price === 'number' && (
179
179
  <tr>
180
180
  <td>{t('DELIVERY_FEE', theme?.defaultLanguages?.DELIVERY_FEE || 'Delivery Fee')}</td>
181
181
  <td>{parsePrice(order?.summary?.delivery_price)}</td>
@@ -12,14 +12,31 @@ export const OrderEta = (props) => {
12
12
  const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
13
13
 
14
14
  const getEstimatedDeliveryTime = () => {
15
- let _estimatedTime = null
15
+ let estimatedUtcTime = null
16
16
  let totalEta = 0
17
+ if (order?.delivered_in) totalEta += order?.delivered_in
18
+ if (order?.prepared_in) totalEta += order?.prepared_in
19
+ if (order?.delivery_type === 1 && order?.eta_drive_time) {
20
+ totalEta += order?.eta_drive_time
21
+ }
22
+
17
23
  const _delivery = order?.delivery_datetime_utc
18
24
  ? order?.delivery_datetime_utc
19
25
  : order?.delivery_datetime
26
+
20
27
  if (order?.eta_current_status_time) {
21
28
  const currentStatueEta = order?.eta_current_status_time
22
29
  totalEta += currentStatueEta
30
+ let previousStatusTimes = 0
31
+ if (order?.eta_previous_status_times) {
32
+ Object.keys(order.eta_previous_status_times).map(key => {
33
+ if (!key.includes('status_penalty')) {
34
+ previousStatusTimes += order.eta_previous_status_times[key]
35
+ }
36
+ })
37
+ }
38
+ totalEta += previousStatusTimes
39
+
23
40
  let nextStatusTimes = 0
24
41
  if (order?.eta_next_status_times) {
25
42
  Object.keys(order.eta_next_status_times).map(key => {
@@ -28,7 +45,6 @@ export const OrderEta = (props) => {
28
45
  }
29
46
  })
30
47
  }
31
-
32
48
  totalEta += nextStatusTimes
33
49
 
34
50
  const diffTimeAsSeconds = moment.utc(order?.reporting_data?.at[`status:${order.status}`]).add(order?.eta_current_status_time, 'minutes').diff(moment().utc(), 'seconds')
@@ -36,15 +52,11 @@ export const OrderEta = (props) => {
36
52
  if (diffTimeAsMinutes <= 0) {
37
53
  totalEta += (Math.floor(Math.abs(diffTimeAsMinutes / order?.eta_current_status_time) + 1) * order?.eta_current_status_penalty_time)
38
54
  }
39
- _estimatedTime = moment.utc(_delivery).add(totalEta, 'minutes')
40
55
  } else {
41
- let timesToAdd = 0
42
- if (order?.delivered_in) timesToAdd += order?.delivered_in
43
- if (order?.prepared_in) timesToAdd += order?.prepared_in
44
- const _etaTime = order?.eta_time + timesToAdd
45
- _estimatedTime = moment.utc(_delivery).add(_etaTime, 'minutes')
56
+ totalEta = order?.eta_time + totalEta
46
57
  }
47
- _estimatedTime = outputFormat ? moment(_estimatedTime).local().format(outputFormat) : parseDate(_estimatedTime, { utc: false })
58
+ estimatedUtcTime = moment.utc(_delivery).add(totalEta, 'minutes')
59
+ const _estimatedTime = outputFormat ? moment(estimatedUtcTime).local().format(outputFormat) : parseDate(estimatedUtcTime, { utc: false })
48
60
  setEstimatedDeliveryTime(_estimatedTime)
49
61
  }
50
62
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { useLanguage, useUtils } from 'ordering-components-external'
2
+ import { useLanguage, useUtils, useConfig } from 'ordering-components-external'
3
3
  import { ArrowRight, CheckCircleFill } from 'react-bootstrap-icons'
4
4
  import { Button } from '../../styles/Buttons'
5
5
  import { formatSeconds, getTraduction } from '../../../../../utils'
@@ -21,6 +21,7 @@ export const OrderHistory = (props) => {
21
21
 
22
22
  const [, t] = useLanguage()
23
23
  const [{ parseDate }] = useUtils()
24
+ const [{ configs }] = useConfig()
24
25
 
25
26
  const getLogisticTagStatus = (status) => {
26
27
  switch (status) {
@@ -113,7 +114,7 @@ export const OrderHistory = (props) => {
113
114
  {t('VIA', 'Via')}{' '}
114
115
  {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
115
116
  </h3>
116
- <p>{parseDate(order.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</p>
117
+ <p>{parseDate(order.created_at, { outputFormat: `MMM DD, ${configs?.general_hour_format?.value}` })}</p>
117
118
  </DetailWrapper>
118
119
  </HistoryItemWrapper>
119
120
  )}
@@ -152,7 +153,7 @@ export const OrderHistory = (props) => {
152
153
  ) : <>{t('DRIVER_UNASSIGNED', 'Driver unassigned')}</>}
153
154
  </h3>
154
155
  )}
155
- <p>{parseDate(message.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</p>
156
+ <p>{parseDate(message.created_at, { outputFormat: `MMM DD, ${configs?.general_hour_format?.value}` })}</p>
156
157
  </DetailWrapper>
157
158
  </HistoryItemWrapper>
158
159
  ))}
@@ -424,7 +424,7 @@ const OrderDetailsUI = (props) => {
424
424
  {activeStatus.includes(order?.status) ? (
425
425
  <OrderEta order={order} />
426
426
  ) : (
427
- parseDate(order?.reporting_data?.at[`status:${order.status}`])
427
+ parseDate(order?.reporting_data?.at[`status:${order.status}`], { outputFormat: `YYYY-MM-DD ${configs?.general_hour_format?.value}` })
428
428
  )}
429
429
  </p>
430
430
  )}
@@ -0,0 +1,70 @@
1
+ import { PaymentOptionStripe, useLanguage, useSession } from 'ordering-components-external'
2
+ import React, { useEffect, useState } from 'react'
3
+ import { CardFormCustom } from '../CardFormCustom'
4
+ import Modal from '../Modal'
5
+ import { PaymentOptionStripeUI } from '../PaymentOptionStripe'
6
+ import { AddNewCard } from '../PaymentOptionStripe/styles'
7
+
8
+ const PaymentOptionCardUI = (props) => {
9
+ const {
10
+ deleteCard,
11
+ cardsList,
12
+ handleCardClick,
13
+ handleNewCard,
14
+ paymethodSelected,
15
+ cardSelected,
16
+ gateway,
17
+ paymethodsWithoutSaveCards,
18
+ onSelectCard
19
+ } = props
20
+
21
+ const [, t] = useLanguage()
22
+ const [{ token }] = useSession()
23
+
24
+ const [addCardOpen, setAddCardOpen] = useState(false)
25
+
26
+ useEffect(() => {
27
+ if (cardsList?.cards?.length > 0) {
28
+ setAddCardOpen(true)
29
+ }
30
+ }, [cardsList?.cards])
31
+
32
+ return (
33
+ <>
34
+ <PaymentOptionStripeUI
35
+ deleteCard={deleteCard}
36
+ cardsList={cardsList}
37
+ handleCardClick={handleCardClick}
38
+ handleNewCard={handleNewCard}
39
+ paymethodSelected={paymethodSelected}
40
+ cardSelected={cardSelected}
41
+ gateway={gateway}
42
+ onSelectCard={onSelectCard}
43
+ />
44
+
45
+ {token && !cardsList.loading && (!cardSelected || !paymethodsWithoutSaveCards.includes(gateway)) && (
46
+ <AddNewCard>
47
+ <span onClick={() => setAddCardOpen(true)}>{t('ADD_NEW_CARD', 'Add new card')}</span>
48
+ </AddNewCard>
49
+ )}
50
+
51
+ <Modal
52
+ open={addCardOpen}
53
+ onClose={() => setAddCardOpen(false)}
54
+ title={t('ADD_NEW_CARD', 'Add new card')}
55
+ >
56
+ <CardFormCustom handleNewCard={handleNewCard} setAddCardOpen={setAddCardOpen} />
57
+ </Modal>
58
+ </>
59
+ )
60
+ }
61
+
62
+ export const PaymentOptionCard = (props) => {
63
+ const paymentOptionStripeProps = {
64
+ ...props,
65
+ UIComponent: PaymentOptionCardUI
66
+ }
67
+ return (
68
+ <PaymentOptionStripe {...paymentOptionStripeProps} />
69
+ )
70
+ }
@@ -5,7 +5,9 @@ import {
5
5
  useSession,
6
6
  useLanguage
7
7
  } from 'ordering-components-external'
8
- import FiMoreVertical from '@meronex/icons/fi/FiMoreVertical'
8
+ import IosRadioButtonOn from '@meronex/icons/ios/IosRadioButtonOn'
9
+ import IosRadioButtonOff from '@meronex/icons/ios/IosRadioButtonOff'
10
+ import { Trash } from 'react-bootstrap-icons'
9
11
  import { useTheme } from 'styled-components'
10
12
 
11
13
  import { Modal } from '../Modal'
@@ -22,16 +24,18 @@ import {
22
24
  CardItemActions,
23
25
  BlockLoading,
24
26
  AddNewCard,
25
- ActionsContent,
26
27
  CardItemActionsWrapper
27
28
  } from './styles'
28
29
 
29
- const PaymentOptionStripeUI = (props) => {
30
+ export const PaymentOptionStripeUI = (props) => {
30
31
  const {
31
32
  deleteCard,
32
33
  cardsList,
33
34
  handleCardClick,
34
- handleNewCard
35
+ handleNewCard,
36
+ paymethodSelected,
37
+ cardSelected,
38
+ gateway
35
39
  } = props
36
40
  const [{ token }] = useSession()
37
41
  const [, t] = useLanguage()
@@ -39,6 +43,8 @@ const PaymentOptionStripeUI = (props) => {
39
43
 
40
44
  const [addCartOpen, setAddCardOpen] = useState(false)
41
45
 
46
+ const paymethodsWithoutSaveCards = ['credomatic']
47
+
42
48
  const _handleNewCard = (card) => {
43
49
  setAddCardOpen(false)
44
50
  handleNewCard(card)
@@ -55,6 +61,12 @@ const PaymentOptionStripeUI = (props) => {
55
61
  })
56
62
  }
57
63
 
64
+ useEffect(() => {
65
+ if (!cardsList?.loading && cardsList?.cards?.length === 0 && !paymethodsWithoutSaveCards.includes(gateway)) {
66
+ setAddCardOpen(true)
67
+ }
68
+ }, [cardsList?.loading])
69
+
58
70
  return (
59
71
  <>
60
72
  {props.beforeElements?.map((BeforeElement, i) => (
@@ -79,7 +91,7 @@ const PaymentOptionStripeUI = (props) => {
79
91
  )}
80
92
  {token && cardsList.cards && cardsList.cards.length > 0 && (
81
93
  <>
82
- {cardsList?.cards?.map((card, i) => (
94
+ {cardsList?.cards?.map((card, i) =>
83
95
  <PaymentCard
84
96
  {...props}
85
97
  key={i}
@@ -87,11 +99,14 @@ const PaymentOptionStripeUI = (props) => {
87
99
  handleDeleteCard={() => handleDeleteCard(card)}
88
100
  card={card}
89
101
  defaultSelected={i === 0}
102
+ active={(paymethodSelected || cardSelected?.id) === card.id}
103
+ cardSelected={cardSelected}
104
+ paymethodSelected={paymethodSelected}
90
105
  />
91
- ))}
106
+ )}
92
107
  </>
93
108
  )}
94
- {token && !cardsList.loading && (
109
+ {token && !cardsList.loading && !paymethodsWithoutSaveCards.includes(gateway) && (
95
110
  <AddNewCard>
96
111
  <span onClick={() => setAddCardOpen(true)}>{t('ADD_NEW_CARD', 'Add new card')}</span>
97
112
  </AddNewCard>
@@ -148,14 +163,15 @@ export const PaymentCard = (props) => {
148
163
  handleDeleteCard,
149
164
  card,
150
165
  handleCardClick,
151
- onSelectCard
166
+ onSelectCard,
167
+ active,
168
+ cardSelected
152
169
  } = props
153
170
 
154
- const [, t] = useLanguage()
155
- const theme = useTheme()
156
171
  const [isShowActions, setIsShowActions] = useState(false)
157
172
  const cardActionsRef = useRef(null)
158
173
  const actionWrapperRef = useRef(null)
174
+ const theme = useTheme()
159
175
 
160
176
  const handleClickOutside = (e) => {
161
177
  if (!isShowActions) return
@@ -168,7 +184,8 @@ export const PaymentCard = (props) => {
168
184
  const handleChangeDefaultCard = (e) => {
169
185
  if (actionWrapperRef.current?.contains(e.target)) return
170
186
  handleCardClick(card)
171
- onSelectCard({
187
+ onSelectCard && onSelectCard({
188
+ ...cardSelected,
172
189
  id: card.id,
173
190
  type: 'card',
174
191
  card: {
@@ -178,6 +195,19 @@ export const PaymentCard = (props) => {
178
195
  })
179
196
  }
180
197
 
198
+ useEffect(() => {
199
+ if (!cardSelected) return
200
+ onSelectCard && onSelectCard({
201
+ ...cardSelected,
202
+ id: cardSelected?.id,
203
+ type: 'card',
204
+ card: {
205
+ brand: cardSelected?.brand,
206
+ last4: cardSelected?.last4
207
+ }
208
+ })
209
+ }, [cardSelected])
210
+
181
211
  useEffect(() => {
182
212
  window.addEventListener('click', handleClickOutside)
183
213
  return () => window.removeEventListener('click', handleClickOutside)
@@ -186,25 +216,21 @@ export const PaymentCard = (props) => {
186
216
  return (
187
217
  <CardItem onClick={handleChangeDefaultCard} isCursor>
188
218
  <CardItemContent>
219
+ <span className='checks'>
220
+ {active ? <IosRadioButtonOn /> : <IosRadioButtonOff />}
221
+ </span>
189
222
  <div>
190
223
  <img src={getIconCard(card?.brand)} alt={card?.brand} />
191
224
  </div>
192
225
  <span>
193
- {card?.brand} {card.last4}
226
+ XXXX-XXXX-XXXX-{card?.last4}
194
227
  </span>
195
228
  </CardItemContent>
196
229
  <CardItemActions>
197
230
  <CardItemActionsWrapper ref={actionWrapperRef}>
198
231
  <span ref={cardActionsRef}>
199
- <FiMoreVertical onClick={() => setIsShowActions(true)} />
232
+ <Trash color={theme.colors.lightGray} onClick={() => handleDeleteCard()} />
200
233
  </span>
201
- {
202
- isShowActions && (
203
- <ActionsContent>
204
- <div className='delete' onClick={handleDeleteCard}>{t('DELETE', 'Delete')}</div>
205
- </ActionsContent>
206
- )
207
- }
208
234
  </CardItemActionsWrapper>
209
235
  </CardItemActions>
210
236
  </CardItem>
@@ -35,11 +35,16 @@ export const CardItem = styled.div`
35
35
  export const CardItemContent = styled.div`
36
36
  display: flex;
37
37
  align-items: center;
38
+
39
+ .checks svg {
40
+ color: ${props => props.theme.colors.primary};
41
+ font-size: 22px;
42
+ }
38
43
 
39
44
  > div {
40
45
  display: flex;
41
46
  align-items: center;
42
- margin-right: 13px;
47
+ margin: 0 13px 0 5px;
43
48
  ${props => props.theme?.rtl && css`
44
49
  margin-left: 13px;
45
50
  margin-right: 0;
@@ -1,6 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import Skeleton from 'react-loading-skeleton'
3
3
  import IosRadioButtonOn from '@meronex/icons/ios/IosRadioButtonOn'
4
+ import BilStripe from '@meronex/icons/bi/BilStripe'
4
5
  import FaCcStripe from '@meronex/icons/fa/FaCcStripe'
5
6
  import FaStripeS from '@meronex/icons/fa/FaStripeS'
6
7
  import GrStripe from '@meronex/icons/gr/GrStripe'
@@ -19,6 +20,7 @@ import { Alert } from '../Confirm'
19
20
  import { PaymentOptionCash } from '../PaymentOptionCash'
20
21
  import { PaymentOptionStripe } from '../PaymentOptionStripe'
21
22
  import { PaymentOptionPaypal } from '../../../../../components/PaymentOptionPaypal'
23
+ import { PaymentOptionCard } from '../PaymentOptionCard'
22
24
  import { StripeElementsForm } from '../StripeElementsForm'
23
25
  import { StripeRedirectForm } from '../StripeRedirectForm'
24
26
  import { NotFoundSource } from '../NotFoundSource'
@@ -42,6 +44,8 @@ const stripeRedirectOptions = [
42
44
  { name: 'iDEAL', value: 'ideal' }
43
45
  ]
44
46
 
47
+ const cardsPaymethods = ['credomatic']
48
+
45
49
  const getPayIcon = (method) => {
46
50
  switch (method) {
47
51
  case 1:
@@ -97,7 +101,8 @@ const PaymentOptionsUI = (props) => {
97
101
  setCreateOrder,
98
102
  onPlaceOrderClick,
99
103
  handlePlaceOrder,
100
- paymethods
104
+ paymethods,
105
+ setCardList
101
106
  } = props
102
107
  const [, t] = useLanguage()
103
108
  const [{ token }] = useSession()
@@ -246,19 +251,38 @@ const PaymentOptionsUI = (props) => {
246
251
  setErrorCash={props.setErrorCash}
247
252
  />
248
253
  )}
249
- {isOpenMethod?.paymethod?.gateway === 'stripe' && isOpenMethod.paymethod?.gateway === 'stripe' && (
254
+ {(isOpenMethod?.paymethod?.gateway === 'stripe' || paymethodSelected?.gateway === 'stripe') && (
250
255
  <PaymentOptionStripe
256
+ setCardList={setCardList}
257
+ paymethod={isOpenMethod?.paymethod}
258
+ businessId={props.businessId}
259
+ publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
260
+ onPaymentChange={onPaymentChange}
261
+ payType={isOpenMethod?.paymethod?.name}
262
+ onSelectCard={handlePaymethodDataChange}
263
+ onCancel={() => handlePaymethodClick(null)}
264
+ paymethodSelected={paymethodSelected?.data?.id}
265
+ handlePaymentMethodClick={handlePaymentMethodClick}
266
+ />
267
+ )}
268
+
269
+ {(cardsPaymethods.includes(isOpenMethod?.paymethod?.gateway) || cardsPaymethods.includes(paymethodSelected?.gateway)) && (
270
+ <PaymentOptionCard
271
+ setCardList={setCardList}
251
272
  paymethod={isOpenMethod?.paymethod}
252
273
  businessId={props.businessId}
253
274
  publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
275
+ gateway={isOpenMethod?.paymethod?.gateway || paymethodSelected?.gateway}
254
276
  onPaymentChange={onPaymentChange}
255
277
  payType={isOpenMethod?.paymethod?.name}
256
278
  onSelectCard={handlePaymethodDataChange}
257
279
  onCancel={() => handlePaymethodClick(null)}
280
+ paymethodSelected={paymethodSelected?.data?.id}
281
+ handlePaymentMethodClick={handlePaymentMethodClick}
258
282
  />
259
283
  )}
260
284
 
261
- {stripeOptions.includes(paymethodSelected?.gateway) && paymethodData?.card && !isCustomerMode && (
285
+ {stripeOptions.includes(paymethodSelected?.gateway) && paymethodData?.card && !isCustomerMode && paymethodSelected?.gateway !== 'stripe' && (
262
286
  <PayCardSelected>
263
287
  <CardItemContent>
264
288
  <span className='checks'>
@@ -317,6 +341,7 @@ const PaymentOptionsUI = (props) => {
317
341
  payType={paymethodsList?.name}
318
342
  onSelectCard={handlePaymethodDataChange}
319
343
  onCancel={() => handlePaymethodClick(null)}
344
+ paymethodSelected={paymethodSelected}
320
345
  />
321
346
  )}
322
347
  </Modal>
@@ -345,7 +345,6 @@ const ProductOptionsUI = (props) => {
345
345
  setIsHaveWeight(true)
346
346
  setPricePerWeightUnit(product?.price / product?.weight)
347
347
  }
348
-
349
348
  }, [product])
350
349
 
351
350
  useEffect(() => {
@@ -398,7 +398,7 @@ export const ProductActions = styled.div`
398
398
  }
399
399
 
400
400
  div.incdec-control {
401
- padding-right: 18%;
401
+ margin-right: 18%;
402
402
  &.show-weight-unit{
403
403
  width: 30%;
404
404
  }
@@ -160,7 +160,7 @@ export const RenderProductsLayout = (props) => {
160
160
  <>
161
161
  {!isLoading && business?.id && (
162
162
  <WrappLayout isCartOnProductsList={isCartOnProductsList}>
163
- {((!hideBusinessNearCity && !useKioskApp) || props.forceShowNearBusiness) && (
163
+ {((!hideBusinessNearCity && !useKioskApp) || props.forceShowNearBusiness) && !isCustomLayout && (
164
164
  <NearBusiness>
165
165
  <BusinessesListing
166
166
  logosLayout
@@ -172,7 +172,7 @@ export const RenderProductsLayout = (props) => {
172
172
  </NearBusiness>
173
173
  )}
174
174
  <div className='bp-list'>
175
- {!isCustomLayout && !useKioskApp && (
175
+ {!useKioskApp && (
176
176
  <BusinessBasicInformationComponent
177
177
  {...props}
178
178
  businessState={businessState}
@@ -6,7 +6,7 @@ export const Container = styled.div`
6
6
  top: 0px;
7
7
  width: 100vw;
8
8
  height: 100vh;
9
- z-index: 2000;
9
+ z-index: 10002;
10
10
  `
11
11
  export const BackDropContainer = styled.div`
12
12
  background: rgba(0,0,0,0.3);
@@ -190,7 +190,7 @@ const UserDetailsUI = (props) => {
190
190
  <CountryFlag>
191
191
  {
192
192
  userData?.country_phone_code && (
193
- <PhoneInput onChange={() => { }} defaultCountry={parsePhoneNumber(`+${(userData?.country_phone_code?.replace('+', ''))} ${userData?.cellphone}`)?.country} />
193
+ <PhoneInput onChange={() => { }} defaultCountry={parsePhoneNumber(`+${(userData?.country_phone_code?.replace('+', ''))} ${userData?.cellphone.replace(`+${userData?.country_phone_code}`, '')}`)?.country} />
194
194
  )
195
195
  }
196
196
  </CountryFlag>
@@ -44,7 +44,7 @@ export const PopoverBody = styled.div`
44
44
  border-radius: 10px;
45
45
  max-width: 500px;
46
46
  min-width: 300px !important;
47
- z-index: 1001;
47
+ z-index: 10002;
48
48
  box-shadow: rgba(0, 0, 0, 0.2) 0px 8px 24px;
49
49
  `
50
50
 
@@ -21,7 +21,8 @@ export const Select = (props) => {
21
21
  notReload,
22
22
  CustomArrow,
23
23
  isHomeStyle,
24
- disableOneOption
24
+ disableOneOption,
25
+ zIndex
25
26
  } = props
26
27
 
27
28
  const isHome = window.location.pathname === '/' || window.location.pathname === '/home' || isHomeStyle
@@ -105,7 +106,7 @@ export const Select = (props) => {
105
106
  </Selected>
106
107
  )}
107
108
  {open && options && (
108
- <Options id='list' position='right' ref={dropdownReference} isHome={isHome}>
109
+ <Options id='list' position='right' ref={dropdownReference} isHome={isHome} zIndex={zIndex}>
109
110
  {
110
111
  options.map((option, i) => (
111
112
  <Option
@@ -37,7 +37,7 @@ export const Options = styled.div`
37
37
  position: absolute;
38
38
  background-color: #CCC;
39
39
  margin-top: 7px;
40
- z-index: 10000;
40
+ z-index: ${({ zIndex }) => zIndex || 10002};
41
41
  border-width: 1px;
42
42
  border-style: solid;
43
43
  border-color: #CCC;
@@ -32,11 +32,14 @@ export const PopoverBody = styled.div`
32
32
  padding-top: 30px;
33
33
  border-radius: 10px;
34
34
  max-width: 500px;
35
- z-index: 1001;
35
+ z-index: 10002;
36
36
  box-shadow: rgba(0, 0, 0, 0.2) 0px 8px 24px;
37
37
  #moment_control h1{
38
38
  margin-bottom: 30px;
39
39
  }
40
+ @media (min-width: 576px) {
41
+ z-index: 1001;
42
+ }
40
43
  `
41
44
 
42
45
  export const PopoverArrow = styled.div`