ordering-ui-external 2.5.9 → 2.6.1

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 (40) hide show
  1. package/_bundles/{7.ordering-ui.c8be47315cef138f7d1e.js → 7.ordering-ui.bdbe517f1ccc205e7de9.js} +1 -1
  2. package/_bundles/ordering-ui.bdbe517f1ccc205e7de9.js +2 -0
  3. package/_modules/components/VerticalOrdersLayout/styles.js +2 -2
  4. package/_modules/themes/five/src/components/AddressForm/index.js +6 -6
  5. package/_modules/themes/five/src/components/AddressList/index.js +38 -15
  6. package/_modules/themes/five/src/components/BusinessListingSearch/styles.js +1 -1
  7. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +1 -1
  8. package/_modules/themes/five/src/components/CardForm/index.js +2 -1
  9. package/_modules/themes/five/src/components/Checkout/styles.js +1 -1
  10. package/_modules/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +28 -6
  11. package/_modules/themes/five/src/components/MultiCartsPaymethodsAndWallets/index.js +7 -5
  12. package/_modules/themes/five/src/components/OrderContextUI/index.js +5 -3
  13. package/_modules/themes/five/src/components/OrderContextUI/styles.js +3 -2
  14. package/_modules/themes/five/src/components/OrderProgress/index.js +7 -6
  15. package/_modules/themes/five/src/components/SidebarMenu/index.js +4 -2
  16. package/package.json +2 -2
  17. package/src/components/VerticalOrdersLayout/styles.js +7 -3
  18. package/src/themes/five/src/components/AddressForm/index.js +12 -3
  19. package/src/themes/five/src/components/AddressList/index.js +5 -3
  20. package/src/themes/five/src/components/BusinessListingSearch/styles.js +3 -0
  21. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +1 -1
  22. package/src/themes/five/src/components/CardForm/index.js +2 -1
  23. package/src/themes/five/src/components/Checkout/styles.js +1 -1
  24. package/src/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +29 -9
  25. package/src/themes/five/src/components/MultiCartsPaymethodsAndWallets/index.js +3 -1
  26. package/src/themes/five/src/components/OrderContextUI/index.js +12 -9
  27. package/src/themes/five/src/components/OrderContextUI/styles.js +1 -1
  28. package/src/themes/five/src/components/OrderProgress/index.js +2 -2
  29. package/src/themes/five/src/components/SidebarMenu/index.js +8 -2
  30. package/_bundles/ordering-ui.c8be47315cef138f7d1e.js +0 -2
  31. /package/_bundles/{0.ordering-ui.c8be47315cef138f7d1e.js → 0.ordering-ui.bdbe517f1ccc205e7de9.js} +0 -0
  32. /package/_bundles/{1.ordering-ui.c8be47315cef138f7d1e.js → 1.ordering-ui.bdbe517f1ccc205e7de9.js} +0 -0
  33. /package/_bundles/{2.ordering-ui.c8be47315cef138f7d1e.js → 2.ordering-ui.bdbe517f1ccc205e7de9.js} +0 -0
  34. /package/_bundles/{4.ordering-ui.c8be47315cef138f7d1e.js → 4.ordering-ui.bdbe517f1ccc205e7de9.js} +0 -0
  35. /package/_bundles/{5.ordering-ui.c8be47315cef138f7d1e.js → 5.ordering-ui.bdbe517f1ccc205e7de9.js} +0 -0
  36. /package/_bundles/{6.ordering-ui.c8be47315cef138f7d1e.js → 6.ordering-ui.bdbe517f1ccc205e7de9.js} +0 -0
  37. /package/_bundles/{7.ordering-ui.c8be47315cef138f7d1e.js.LICENSE.txt → 7.ordering-ui.bdbe517f1ccc205e7de9.js.LICENSE.txt} +0 -0
  38. /package/_bundles/{8.ordering-ui.c8be47315cef138f7d1e.js → 8.ordering-ui.bdbe517f1ccc205e7de9.js} +0 -0
  39. /package/_bundles/{9.ordering-ui.c8be47315cef138f7d1e.js → 9.ordering-ui.bdbe517f1ccc205e7de9.js} +0 -0
  40. /package/_bundles/{ordering-ui.c8be47315cef138f7d1e.js.LICENSE.txt → ordering-ui.bdbe517f1ccc205e7de9.js.LICENSE.txt} +0 -0
@@ -1,6 +1,6 @@
1
- import React, { useEffect, useState } from 'react'
1
+ import React, { useEffect, useState, useRef } from 'react'
2
2
  import { useLanguage, useUtils, RedeemGiftCard as RedeemGiftCardController } from 'ordering-components-external'
3
- import { useForm } from 'react-hook-form'
3
+ import { useForm, Controller } from 'react-hook-form'
4
4
  import { Alert } from '../../Confirm'
5
5
  import { Button } from '../../../styles/Buttons'
6
6
  import { Input } from '../../../styles/Inputs'
@@ -22,13 +22,23 @@ const RedeemGiftCardUI = (props) => {
22
22
 
23
23
  const [, t] = useLanguage()
24
24
  const [{ parsePrice }] = useUtils()
25
- const { register, handleSubmit, errors } = useForm()
25
+ const { control, register, handleSubmit, errors } = useForm()
26
26
  const [alertState, setAlertState] = useState({ open: false, content: [] })
27
+ const codeRef = useRef(null)
27
28
 
28
29
  const onSubmit = (values) => {
29
30
  handleApply(values)
30
31
  }
31
32
 
33
+ const handleChangeCode = (event) => {
34
+ let string = event.target.value
35
+ string = string.replace(/-/g, '')
36
+ if (!string) return
37
+ const codeSlices = string.match(/.{1,4}/g)
38
+ string = codeSlices.join('-')
39
+ codeRef.current.value = string
40
+ }
41
+
32
42
  useEffect(() => {
33
43
  if (Object.keys(errors).length > 0) {
34
44
  setAlertState({
@@ -53,14 +63,24 @@ const RedeemGiftCardUI = (props) => {
53
63
  <h2>{t('REDEEM_GIFT_CARD', 'Redeem a gift card')}</h2>
54
64
  <FormController>
55
65
  <label>{t('GIFT_CARD_CODE', 'Gift card code')}</label>
56
- <Input
66
+ <Controller
57
67
  name='code'
58
- placeholder='0000 0000'
59
- type='text'
60
- ref={register({
68
+ control={control}
69
+ render={({ onChange, value }) => (
70
+ <Input
71
+ placeholder='XXXX-XXXX-XXXX-XXXX'
72
+ type='text'
73
+ autoComplete='off'
74
+ ref={codeRef}
75
+ onChange={e => {
76
+ onChange(e.target.value)
77
+ handleChangeCode(e)
78
+ }}
79
+ />
80
+ )}
81
+ rules={{
61
82
  required: t('VALIDATION_ERROR_REQUIRED', 'Code is required').replace('_attribute_', t('CODE', 'Code'))
62
- })}
63
- autoComplete='off'
83
+ }}
64
84
  />
65
85
  </FormController>
66
86
  <FormController>
@@ -136,10 +136,12 @@ const MultiCartsPaymethodsAndWalletsUI = (props) => {
136
136
  publicKey={paymethodSelected?.paymethod?.credentials?.publishable}
137
137
  payType={paymethodSelected?.paymethod?.name}
138
138
  onSelectCard={handlePaymethodDataChange}
139
+ paymethodSelected={paymethodSelected?.data?.id}
140
+ setCardList={setCardList}
139
141
  />
140
142
  )}
141
143
 
142
- {stripeOptions.includes(paymethodSelected?.paymethod?.gateway) && paymethodSelected?.paymethod_data?.card && (
144
+ {stripeOptions.includes(paymethodSelected?.paymethod?.gateway) && paymethodSelected?.paymethod_data?.card && paymethodSelected?.gateway !== 'stripe' && (
143
145
  <PayCardSelected>
144
146
  <CardItemContent>
145
147
  <span className='checks'>
@@ -29,6 +29,7 @@ export const OrderContextUI = (props) => {
29
29
  const userCustomer = JSON.parse(window.localStorage.getItem('user-customer'))
30
30
 
31
31
  const configTypes = configState?.configs?.order_types_allowed?.value.split('|').map(value => Number(value)) || []
32
+ const isPreOrderSetting = configState?.configs?.preorder_status_enabled?.value === '1'
32
33
 
33
34
  const handleTogglePopover = (type) => {
34
35
  setOpenPopover({
@@ -67,7 +68,7 @@ export const OrderContextUI = (props) => {
67
68
 
68
69
  return (
69
70
  <>
70
- <Container isBusinessList={isBusinessList} hero={props.hideHero} >
71
+ <Container isBusinessList={isBusinessList} hero={props.hideHero} isCheckOut={isCheckOut}>
71
72
  <AddressMenu
72
73
  onClick={() => handleClickAddress()}
73
74
  isCheckOut={isCheckOut}
@@ -79,14 +80,16 @@ export const OrderContextUI = (props) => {
79
80
  <ItemInline>
80
81
  <OrderTypeSelectorHeader configTypes={configTypes} />
81
82
  </ItemInline>
82
- <ItemInline>
83
- <MomentPopover
84
- open={openPopover.moment}
85
- onClick={() => handleTogglePopover('moment')}
86
- onClose={() => handleClosePopover('moment')}
87
- isBanner
88
- />
89
- </ItemInline>
83
+ {isPreOrderSetting && (
84
+ <ItemInline>
85
+ <MomentPopover
86
+ open={openPopover.moment}
87
+ onClick={() => handleTogglePopover('moment')}
88
+ onClose={() => handleClosePopover('moment')}
89
+ isBanner
90
+ />
91
+ </ItemInline>
92
+ )}
90
93
  </FeatureItems>
91
94
  </Container>
92
95
  <Modal
@@ -6,7 +6,7 @@ export const Container = styled.div`
6
6
  padding: 0 15px;
7
7
  box-sizing: border-box;
8
8
  `}
9
- ${({ hero }) => hero && css`
9
+ ${({ hero, isCheckOut }) => !(hero || isCheckOut) && css`
10
10
  position: absolute;
11
11
  top: 10%;
12
12
  `}
@@ -47,7 +47,7 @@ const OrderProgressUI = (props) => {
47
47
 
48
48
  useEffect(() => {
49
49
  if (orderList?.orders.length > 0) {
50
- const sortedOrders = orderList.orders.sort((a, b) => a.id > b.id ? -1 : 1)
50
+ const sortedOrders = orderList.orders.filter(order => !!order?.business).sort((a, b) => a.id > b.id ? -1 : 1)
51
51
  const orderInProgress = sortedOrders.find(({ status }) => (statusToShow.includes(status)))
52
52
 
53
53
  let _lastOrder = null
@@ -109,7 +109,7 @@ const OrderProgressUI = (props) => {
109
109
  <span>{lastOrder?.delivery_type === 1 ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}:&nbsp;</span>
110
110
  <span>
111
111
  {lastOrder?.delivery_datetime_utc
112
- ? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: 'hh:mm A', utc: false })
112
+ ? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: configs?.general_hour_format?.value || 'HH:mm' })
113
113
  : parseTime(lastOrder?.delivery_datetime, { utc: false })}
114
114
  &nbsp;-&nbsp;
115
115
  {statusToShow.includes(lastOrder?.status) ? (
@@ -475,7 +475,10 @@ export const SidebarMenu = (props) => {
475
475
  {!auth && (
476
476
  <>
477
477
  <MenuLink
478
- onClick={() => handleOpenLoginSignUp('login')}
478
+ onClick={() => {
479
+ handleOpenLoginSignUp('login')
480
+ actionSidebar(false)
481
+ }}
479
482
  >
480
483
  <WrappContent>
481
484
  <MenuLinkIcon
@@ -499,7 +502,10 @@ export const SidebarMenu = (props) => {
499
502
  </MenuLink>
500
503
  {!isHideSignup && (
501
504
  <MenuLink
502
- onClick={() => handleOpenLoginSignUp('signup')}
505
+ onClick={() => {
506
+ handleOpenLoginSignUp('signup')
507
+ actionSidebar(false)
508
+ }}
503
509
  >
504
510
  <WrappContent>
505
511
  <MenuLinkIcon