ordering-ui-admin-external 1.43.86 → 1.43.88
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/{ordering-ui-admin.89cc92ea829107eb0896.js → ordering-ui-admin.79d573230ba669643af1.js} +2 -2
- package/_modules/components/Orders/AllInOne/index.js +38 -38
- package/_modules/components/Orders/DeliveriesManager/index.js +13 -15
- package/_modules/components/Orders/OrderContactInformation/index.js +4 -2
- package/_modules/components/Orders/OrderDetails/index.js +3 -1
- package/_modules/components/Orders/OrdersContentHeader/index.js +4 -2
- package/_modules/components/Orders/OrdersFilterGroup/index.js +1 -2
- package/_modules/components/Orders/OrdersHeaderFilterGroup/index.js +4 -2
- package/_modules/components/Orders/OrdersManager/index.js +35 -33
- package/_modules/components/Stores/BusinessPaymentMethods/index.js +39 -2
- package/_modules/components/Stores/PaymentOptionStripeLink/index.js +347 -0
- package/_modules/components/Stores/PaymentOptionStripeLink/styles.js +57 -0
- package/_modules/components/Stores/ProductExtraOptionDetails/index.js +10 -8
- package/_modules/components/Stores/ProductExtraSuboption/index.js +13 -3
- package/_modules/components/Stores/index.js +7 -0
- package/_modules/index.js +6 -0
- package/package.json +2 -2
- package/src/components/Orders/AllInOne/index.js +5 -2
- package/src/components/Orders/DeliveriesManager/index.js +3 -2
- package/src/components/Orders/OrderContactInformation/index.js +3 -1
- package/src/components/Orders/OrderDetails/index.js +3 -1
- package/src/components/Orders/OrdersContentHeader/index.js +3 -1
- package/src/components/Orders/OrdersFilterGroup/index.js +0 -2
- package/src/components/Orders/OrdersHeaderFilterGroup/index.js +3 -1
- package/src/components/Orders/OrdersManager/index.js +7 -2
- package/src/components/Stores/BusinessPaymentMethods/index.js +41 -0
- package/src/components/Stores/PaymentOptionStripeLink/index.js +357 -0
- package/src/components/Stores/PaymentOptionStripeLink/styles.js +171 -0
- package/src/components/Stores/ProductExtraOptionDetails/index.js +5 -4
- package/src/components/Stores/ProductExtraSuboption/index.js +15 -3
- package/src/components/Stores/index.js +2 -0
- package/src/index.js +2 -0
- /package/_bundles/{ordering-ui-admin.89cc92ea829107eb0896.js.LICENSE.txt → ordering-ui-admin.79d573230ba669643af1.js.LICENSE.txt} +0 -0
|
@@ -78,7 +78,8 @@ const OrderDetailsUI = (props) => {
|
|
|
78
78
|
handleRefundPaymentsStripe,
|
|
79
79
|
handleOrderRefund,
|
|
80
80
|
isServiceOrder,
|
|
81
|
-
handleUpdateComment
|
|
81
|
+
handleUpdateComment,
|
|
82
|
+
disableSocketRoomDriver
|
|
82
83
|
} = props
|
|
83
84
|
|
|
84
85
|
const {
|
|
@@ -419,6 +420,7 @@ const OrderDetailsUI = (props) => {
|
|
|
419
420
|
)}
|
|
420
421
|
<div data-tour='tour_driver'>
|
|
421
422
|
<OrderContactInformation
|
|
423
|
+
disableSocketRoomDriver={disableSocketRoomDriver}
|
|
422
424
|
isServiceOrder={isServiceOrder}
|
|
423
425
|
customerInfoState={customerInfoState}
|
|
424
426
|
handleChangeCustomerInfoState={handleChangeCustomerInfoState}
|
|
@@ -44,7 +44,8 @@ export const OrdersContentHeader = (props) => {
|
|
|
44
44
|
setTimeStatus,
|
|
45
45
|
setSlaSettingTime,
|
|
46
46
|
isShowMapsKeySettingButton,
|
|
47
|
-
adminsList
|
|
47
|
+
adminsList,
|
|
48
|
+
disableSocketRoomDriver
|
|
48
49
|
} = props
|
|
49
50
|
|
|
50
51
|
const { width } = useWindowSize()
|
|
@@ -104,6 +105,7 @@ export const OrdersContentHeader = (props) => {
|
|
|
104
105
|
searchValue={searchValue}
|
|
105
106
|
handleChangeFilterValues={handleChangeFilterValues}
|
|
106
107
|
handleChangeSearch={handleChangeSearch}
|
|
108
|
+
disableSocketRoomDriver={disableSocketRoomDriver}
|
|
107
109
|
/>
|
|
108
110
|
</WrapperHeaderFilterGroup>
|
|
109
111
|
<WebsocketStatus />
|
|
@@ -6,9 +6,7 @@ import { useLanguage, useConfig, OrdersFilter as OrdersFilterController } from '
|
|
|
6
6
|
import { BusinessesSelector } from '../BusinessesSelector'
|
|
7
7
|
import { DriversGroupTypeSelector } from '../DriversGroupTypeSelector'
|
|
8
8
|
import { DateTypeSelector } from '../DateTypeSelector'
|
|
9
|
-
import { DriverMultiSelector } from '../DriverMultiSelector'
|
|
10
9
|
import { CitySelector, Modal } from '../../Shared'
|
|
11
|
-
// import { OrderStatusTypeSelector } from '../OrderStatusTypeSelector'
|
|
12
10
|
import { DeliveryTypeSelector } from '../DeliveryTypeSelector'
|
|
13
11
|
import { PaymethodTypeSelector } from '../PaymethodTypeSelector'
|
|
14
12
|
import { CountryFilter } from '../CountryFilter'
|
|
@@ -18,7 +18,8 @@ const OrdersHeaderFilterGroupUI = (props) => {
|
|
|
18
18
|
handleChangeExternalId,
|
|
19
19
|
handleChangeGroup,
|
|
20
20
|
isSelectedOrders,
|
|
21
|
-
assignableDriverGroupList
|
|
21
|
+
assignableDriverGroupList,
|
|
22
|
+
disableSocketRoomDriver
|
|
22
23
|
} = props
|
|
23
24
|
|
|
24
25
|
const [{ dictionary }] = useLanguage()
|
|
@@ -72,6 +73,7 @@ const OrdersHeaderFilterGroupUI = (props) => {
|
|
|
72
73
|
driversList={driversList}
|
|
73
74
|
filterValues={filterValues}
|
|
74
75
|
handleChangeDriver={handleChangeDriver}
|
|
76
|
+
disableSocketRoomDriver={disableSocketRoomDriver}
|
|
75
77
|
/>
|
|
76
78
|
)}
|
|
77
79
|
{!loading && configFilter.includes('driver_group') && assignableDriverGroupList && (
|
|
@@ -53,7 +53,10 @@ const OrdersManagerUI = (props) => {
|
|
|
53
53
|
timeStatus,
|
|
54
54
|
setTimeStatus,
|
|
55
55
|
isUseQuery,
|
|
56
|
-
disableDriverLocationsSockets
|
|
56
|
+
disableDriverLocationsSockets,
|
|
57
|
+
detailsOrder,
|
|
58
|
+
setDetailsOrder,
|
|
59
|
+
disableSocketRoomDriver
|
|
57
60
|
} = props
|
|
58
61
|
|
|
59
62
|
const [, t] = useLanguage()
|
|
@@ -63,7 +66,6 @@ const OrdersManagerUI = (props) => {
|
|
|
63
66
|
const query = new URLSearchParams(useLocation().search)
|
|
64
67
|
const [isOpenOrderDetail, setIsOpenOrderDetail] = useState(false)
|
|
65
68
|
const [orderDetailId, setOrderDetailId] = useState(null)
|
|
66
|
-
const [detailsOrder, setDetailsOrder] = useState(null)
|
|
67
69
|
const [filterModalOpen, setFilterModalOpen] = useState(false)
|
|
68
70
|
|
|
69
71
|
const [isTourOpen, setIsTourOpen] = useState(false)
|
|
@@ -199,6 +201,7 @@ const OrdersManagerUI = (props) => {
|
|
|
199
201
|
setSlaSettingTime={setSlaSettingTime}
|
|
200
202
|
isLateralBar={isLateralBar}
|
|
201
203
|
disableDriverLocationsSockets={disableDriverLocationsSockets}
|
|
204
|
+
disableSocketRoomDriver={disableSocketRoomDriver}
|
|
202
205
|
/>
|
|
203
206
|
<OrderStatusFilterBar
|
|
204
207
|
isUseQuery={isUseQuery}
|
|
@@ -264,6 +267,7 @@ const OrdersManagerUI = (props) => {
|
|
|
264
267
|
ordersAmountByStatus={ordersAmountByStatus}
|
|
265
268
|
setOrdersAmountByStatus={setOrdersAmountByStatus}
|
|
266
269
|
franchisesList={props.franchisesList}
|
|
270
|
+
disableSocketRoomDriver={disableSocketRoomDriver}
|
|
267
271
|
/>
|
|
268
272
|
</WrapItemView>
|
|
269
273
|
</OrdersInnerContent>
|
|
@@ -284,6 +288,7 @@ const OrdersManagerUI = (props) => {
|
|
|
284
288
|
setIsTourFlag={setIsTourFlag}
|
|
285
289
|
setIsTourOpen={setIsTourOpen}
|
|
286
290
|
drivers={driversList.drivers}
|
|
291
|
+
disableSocketRoomDriver={disableSocketRoomDriver}
|
|
287
292
|
/>
|
|
288
293
|
)}
|
|
289
294
|
|
|
@@ -13,6 +13,7 @@ import { useWindowSize } from '../../../hooks/useWindowSize'
|
|
|
13
13
|
import { Modal, SearchBar, Alert } from '../../Shared'
|
|
14
14
|
import { Button } from '../../../styles'
|
|
15
15
|
import { PaymentOptionStripeDirect } from '../PaymentOptionStripeDirect'
|
|
16
|
+
import { PaymentOptionStripeLink } from '../PaymentOptionStripeLink'
|
|
16
17
|
import { PaymentOption } from '../PaymentOption'
|
|
17
18
|
import { PaymethodOptionPaypalExpress } from '../PaymethodOptionPaypalExpress'
|
|
18
19
|
import { PaymethodOptionStripeRedirect } from '../PaymethodOptionStripeRedirect'
|
|
@@ -269,6 +270,7 @@ const BusinessPaymentMethodsUI = (props) => {
|
|
|
269
270
|
<>
|
|
270
271
|
{
|
|
271
272
|
!['stripe_direct',
|
|
273
|
+
'stripe_link',
|
|
272
274
|
'paypal',
|
|
273
275
|
'paypal_express',
|
|
274
276
|
'stripe_redirect',
|
|
@@ -351,6 +353,25 @@ const BusinessPaymentMethodsUI = (props) => {
|
|
|
351
353
|
handleDeletePaymethod={handleDeleteBusinessPaymethodOption}
|
|
352
354
|
/>
|
|
353
355
|
)}
|
|
356
|
+
{selectedPaymethodGateway === 'stripe_link' && (
|
|
357
|
+
<PaymentOptionStripeLink
|
|
358
|
+
business={business}
|
|
359
|
+
sitesState={sitesState}
|
|
360
|
+
open={isEdit}
|
|
361
|
+
onClose={() => handleCloseEdit()}
|
|
362
|
+
businessPaymethod={selectedBusinessPaymethod}
|
|
363
|
+
changesState={changesState}
|
|
364
|
+
orderTypes={orderTypes}
|
|
365
|
+
handleChangeBusinessPaymentState={handleChangeBusinessPaymentState}
|
|
366
|
+
cleanChangesState={cleanChangesState}
|
|
367
|
+
actionState={actionState}
|
|
368
|
+
handleChangeSandbox={handleChangeSandbox}
|
|
369
|
+
handleChangeInput={handleChangeInput}
|
|
370
|
+
handleSaveClick={handleSaveClick}
|
|
371
|
+
handleDeletePaymethod={handleDeleteBusinessPaymethodOption}
|
|
372
|
+
handleSuccessUpdate={handleSuccessUpdate}
|
|
373
|
+
/>
|
|
374
|
+
)}
|
|
354
375
|
{selectedPaymethodGateway === 'paypal' && (
|
|
355
376
|
<PaymentOptionPaypal
|
|
356
377
|
open={isEdit}
|
|
@@ -466,6 +487,7 @@ const BusinessPaymentMethodsUI = (props) => {
|
|
|
466
487
|
>
|
|
467
488
|
{
|
|
468
489
|
!['stripe_direct',
|
|
490
|
+
'stripe_link',
|
|
469
491
|
'paypal',
|
|
470
492
|
'paypal_express',
|
|
471
493
|
'stripe_redirect',
|
|
@@ -507,6 +529,25 @@ const BusinessPaymentMethodsUI = (props) => {
|
|
|
507
529
|
handleDeletePaymethod={handleDeleteBusinessPaymethodOption}
|
|
508
530
|
/>
|
|
509
531
|
)}
|
|
532
|
+
{selectedPaymethodGateway === 'stripe_link' && (
|
|
533
|
+
<PaymentOptionStripeLink
|
|
534
|
+
business={business}
|
|
535
|
+
sitesState={sitesState}
|
|
536
|
+
open={isEdit}
|
|
537
|
+
onClose={() => handleCloseEdit()}
|
|
538
|
+
businessPaymethod={selectedBusinessPaymethod}
|
|
539
|
+
changesState={changesState}
|
|
540
|
+
orderTypes={orderTypes}
|
|
541
|
+
handleChangeBusinessPaymentState={handleChangeBusinessPaymentState}
|
|
542
|
+
cleanChangesState={cleanChangesState}
|
|
543
|
+
actionState={actionState}
|
|
544
|
+
handleChangeSandbox={handleChangeSandbox}
|
|
545
|
+
handleChangeInput={handleChangeInput}
|
|
546
|
+
handleSaveClick={handleSaveClick}
|
|
547
|
+
handleDeletePaymethod={handleDeleteBusinessPaymethodOption}
|
|
548
|
+
handleSuccessUpdate={handleSuccessUpdate}
|
|
549
|
+
/>
|
|
550
|
+
)}
|
|
510
551
|
{selectedPaymethodGateway === 'paypal' && (
|
|
511
552
|
<PaymentOptionPaypal
|
|
512
553
|
open={isEdit}
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { useLocation } from 'react-router-dom'
|
|
3
|
+
import { useLanguage, PaymentOptionStripeLink as PaymentOptionStripeLinkController } from 'ordering-components-admin-external'
|
|
4
|
+
import RiCheckboxBlankLine from '@meronex/icons/ri/RiCheckboxBlankLine'
|
|
5
|
+
import RiCheckboxFill from '@meronex/icons/ri/RiCheckboxFill'
|
|
6
|
+
import { Button, Input, IconButton, Checkbox, DefaultSelect as Select } from '../../../styles'
|
|
7
|
+
import { useWindowSize } from '../../../hooks/useWindowSize'
|
|
8
|
+
import { useTheme } from 'styled-components'
|
|
9
|
+
import { ThreeDots, XLg } from 'react-bootstrap-icons'
|
|
10
|
+
import { Dropdown, DropdownButton } from 'react-bootstrap'
|
|
11
|
+
import { Confirm } from '../../Shared'
|
|
12
|
+
import { addQueryToUrl } from '../../../utils'
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
Container,
|
|
16
|
+
SandboxWrapper,
|
|
17
|
+
FieldName,
|
|
18
|
+
Header,
|
|
19
|
+
CloseButton,
|
|
20
|
+
TabOption,
|
|
21
|
+
TabOptionName,
|
|
22
|
+
ActionSelectorWrapper,
|
|
23
|
+
Option
|
|
24
|
+
} from './styles'
|
|
25
|
+
import { Tab, TabsContainer } from '../BusinessMenu/styles'
|
|
26
|
+
|
|
27
|
+
const PaymentOptionStripeLinkUI = (props) => {
|
|
28
|
+
const {
|
|
29
|
+
open,
|
|
30
|
+
onClose,
|
|
31
|
+
orderTypes,
|
|
32
|
+
sitesState,
|
|
33
|
+
configsState,
|
|
34
|
+
changesState,
|
|
35
|
+
handleChangeBusinessPaymentState,
|
|
36
|
+
cleanChangesState,
|
|
37
|
+
actionState,
|
|
38
|
+
handleChangeSandbox,
|
|
39
|
+
handleChangeInput,
|
|
40
|
+
handleSaveClick,
|
|
41
|
+
businessPaymethod,
|
|
42
|
+
handleDeletePaymethod,
|
|
43
|
+
handleUpdateConfigs
|
|
44
|
+
} = props
|
|
45
|
+
|
|
46
|
+
const query = new URLSearchParams(useLocation().search)
|
|
47
|
+
const theme = useTheme()
|
|
48
|
+
const [, t] = useLanguage()
|
|
49
|
+
const { width } = useWindowSize()
|
|
50
|
+
const [isMenuOpen, setIsMenuOpen] = useState(false)
|
|
51
|
+
const [paymentTabs, setPaymentTabs] = useState(0)
|
|
52
|
+
const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
|
|
53
|
+
const [localState, setLocalState] = useState({ allowed_order_types: businessPaymethod?.allowed_order_types, sites: businessPaymethod?.sites })
|
|
54
|
+
const filteredOptions = localState?.sites ?? businessPaymethod?.sites?.filter(a => sitesState?.sites?.find(b => a.id === b.id))
|
|
55
|
+
const [all, setAll] = useState(!filteredOptions?.length)
|
|
56
|
+
|
|
57
|
+
const configsToShow = {
|
|
58
|
+
allow_text_messages_sms: true,
|
|
59
|
+
allow_text_messages_whatsapp: true
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const setPaymethodInfo = (values) => {
|
|
63
|
+
const data = {}
|
|
64
|
+
if (values?.value === 'All') {
|
|
65
|
+
data[values.key] = []
|
|
66
|
+
setAll(!all)
|
|
67
|
+
} else {
|
|
68
|
+
let array = changesState?.[values.key] ?? (values.key === 'allowed_order_types'
|
|
69
|
+
? businessPaymethod?.[values.key]
|
|
70
|
+
: businessPaymethod?.[values.key]?.map(i => i.id)) ?? []
|
|
71
|
+
|
|
72
|
+
array = [...new Set(
|
|
73
|
+
array.includes(values.value)
|
|
74
|
+
? array.filter(item => item !== values.value)
|
|
75
|
+
: [...array, values.value]
|
|
76
|
+
)]
|
|
77
|
+
|
|
78
|
+
data[values.key] = array.length > 0 ? array : []
|
|
79
|
+
if (values.key === 'sites') {
|
|
80
|
+
setAll(!data?.sites?.length)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
handleChangeBusinessPaymentState(data)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const actionSidebar = (value) => {
|
|
88
|
+
if (!value) {
|
|
89
|
+
props.onClose()
|
|
90
|
+
}
|
|
91
|
+
setIsMenuOpen(value)
|
|
92
|
+
}
|
|
93
|
+
const onClickDeletePaymethod = () => {
|
|
94
|
+
setConfirm({
|
|
95
|
+
open: true,
|
|
96
|
+
content: t('QUESTION_DELETE_ITEM', 'Are you sure to delete this _item_?').replace('_item_', t('PAYMETHOD_ID', 'Paymethod')),
|
|
97
|
+
handleOnAccept: () => {
|
|
98
|
+
setConfirm({ ...confirm, open: false })
|
|
99
|
+
handleDeletePaymethod(businessPaymethod?.paymethod?.id)
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (isMenuOpen) {
|
|
105
|
+
if (width < 1000) {
|
|
106
|
+
document.getElementById('stripe_link').style.width = '100%'
|
|
107
|
+
} else {
|
|
108
|
+
document.getElementById('stripe_link').style.width = '500px'
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, [width])
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (!open) return
|
|
115
|
+
actionSidebar(true)
|
|
116
|
+
}, [open])
|
|
117
|
+
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
const initState = {
|
|
120
|
+
sandbox: businessPaymethod?.sandbox,
|
|
121
|
+
allowed_order_types: businessPaymethod?.allowed_order_types || [1, 2, 3, 4, 5]
|
|
122
|
+
}
|
|
123
|
+
if (businessPaymethod?.data) {
|
|
124
|
+
initState.data = businessPaymethod.data
|
|
125
|
+
}
|
|
126
|
+
if (businessPaymethod?.data_sandbox) {
|
|
127
|
+
initState.data_sandbox = businessPaymethod.data_sandbox
|
|
128
|
+
}
|
|
129
|
+
cleanChangesState(initState)
|
|
130
|
+
}, [])
|
|
131
|
+
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
const changes = {}
|
|
134
|
+
if (changesState?.allowed_order_types) changes.allowed_order_types = changesState?.allowed_order_types
|
|
135
|
+
if (changesState?.sites) changes.sites = changesState?.sites
|
|
136
|
+
if (Object.keys(changes).length > 0) setLocalState(JSON.parse(JSON.stringify(changes)))
|
|
137
|
+
}, [changesState?.sites, changesState?.allowed_order_types])
|
|
138
|
+
|
|
139
|
+
const handleTabClick = (tab, isInitialRender) => {
|
|
140
|
+
setPaymentTabs(tab)
|
|
141
|
+
if (!isInitialRender) {
|
|
142
|
+
addQueryToUrl({ payemthod_tab: tab })
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
const payemthodTab = query.get('payemthod_tab')
|
|
148
|
+
if (payemthodTab) {
|
|
149
|
+
handleTabClick(Number(payemthodTab), true)
|
|
150
|
+
} else {
|
|
151
|
+
handleTabClick(0)
|
|
152
|
+
}
|
|
153
|
+
}, [])
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<>
|
|
157
|
+
<Container id='stripe_link'>
|
|
158
|
+
<Header>
|
|
159
|
+
<h1>{t('STRIPE_LINK', 'Stripe link (Only for callcenter)')}</h1>
|
|
160
|
+
<ActionSelectorWrapper>
|
|
161
|
+
<DropdownButton
|
|
162
|
+
menuAlign={theme?.rtl ? 'left' : 'right'}
|
|
163
|
+
title={<ThreeDots />}
|
|
164
|
+
id={theme?.rtl ? 'dropdown-menu-align-left' : 'dropdown-menu-align-right'}
|
|
165
|
+
>
|
|
166
|
+
<Dropdown.Item
|
|
167
|
+
onClick={() => onClickDeletePaymethod()}
|
|
168
|
+
>
|
|
169
|
+
{t('DELETE', 'Delete')}
|
|
170
|
+
</Dropdown.Item>
|
|
171
|
+
</DropdownButton>
|
|
172
|
+
</ActionSelectorWrapper>
|
|
173
|
+
<CloseButton>
|
|
174
|
+
<IconButton
|
|
175
|
+
color='black'
|
|
176
|
+
onClick={() => onClose()}
|
|
177
|
+
>
|
|
178
|
+
<XLg />
|
|
179
|
+
</IconButton>
|
|
180
|
+
</CloseButton>
|
|
181
|
+
</Header>
|
|
182
|
+
<p className='message'>{t('STRIPE_AND_TWILIO_CONFIGS_REQUIERED', 'Stripe and Twilio keys are requiered to use this Payment Method')}</p>
|
|
183
|
+
<TabsContainer>
|
|
184
|
+
<Tab
|
|
185
|
+
active={paymentTabs === 0}
|
|
186
|
+
onClick={() => handleTabClick(0)}
|
|
187
|
+
>
|
|
188
|
+
{t('GENERAL', 'General')}
|
|
189
|
+
</Tab>
|
|
190
|
+
{sitesState?.sites?.length > 0 && (
|
|
191
|
+
<Tab
|
|
192
|
+
active={paymentTabs === 1}
|
|
193
|
+
onClick={() => handleTabClick(1)}
|
|
194
|
+
>
|
|
195
|
+
{t('CHANNELS', 'Channels')}
|
|
196
|
+
</Tab>
|
|
197
|
+
)}
|
|
198
|
+
<Tab
|
|
199
|
+
active={paymentTabs === 2}
|
|
200
|
+
onClick={() => handleTabClick(2)}
|
|
201
|
+
>
|
|
202
|
+
{t('ORDER_TYPE', 'Order type')}
|
|
203
|
+
</Tab>
|
|
204
|
+
</TabsContainer>
|
|
205
|
+
|
|
206
|
+
{paymentTabs === 0 && (
|
|
207
|
+
<>
|
|
208
|
+
<SandboxWrapper>
|
|
209
|
+
<Checkbox
|
|
210
|
+
checked={changesState?.sandbox ?? businessPaymethod?.sandbox ?? false}
|
|
211
|
+
onChange={e => handleChangeSandbox(e.target.checked)}
|
|
212
|
+
/>
|
|
213
|
+
<span>{t('SANDBOX', 'Sandbox')}</span>
|
|
214
|
+
</SandboxWrapper>
|
|
215
|
+
<FieldName>{t('PUBLISHABLE_KEY', 'Publishable key')}</FieldName>
|
|
216
|
+
<Input
|
|
217
|
+
name='publishable'
|
|
218
|
+
defaultValue={
|
|
219
|
+
changesState?.data?.publishable
|
|
220
|
+
? changesState?.data?.publishable
|
|
221
|
+
: businessPaymethod?.data?.publishable
|
|
222
|
+
}
|
|
223
|
+
placeholder={t('PUBLISHABLE_KEY', 'Publishable key')}
|
|
224
|
+
onChange={e => handleChangeInput(e, false)}
|
|
225
|
+
/>
|
|
226
|
+
<FieldName>{t('SECRET_KEY', 'Secret key')}</FieldName>
|
|
227
|
+
<Input
|
|
228
|
+
name='secret'
|
|
229
|
+
defaultValue={
|
|
230
|
+
changesState?.data?.secret
|
|
231
|
+
? changesState?.data?.secret
|
|
232
|
+
: businessPaymethod?.data?.secret
|
|
233
|
+
}
|
|
234
|
+
placeholder={t('SECRET_KEY', 'Secret key')}
|
|
235
|
+
onChange={e => handleChangeInput(e, false)}
|
|
236
|
+
/>
|
|
237
|
+
<FieldName>{t('PUBLISHABLE_KEY', 'Publishable key')} ({t('SANDBOX', 'Sandbox')})</FieldName>
|
|
238
|
+
<Input
|
|
239
|
+
name='publishable'
|
|
240
|
+
defaultValue={
|
|
241
|
+
changesState?.data_sandbox?.publishable
|
|
242
|
+
? changesState?.data_sandbox?.publishable
|
|
243
|
+
: businessPaymethod?.data_sandbox?.publishable
|
|
244
|
+
}
|
|
245
|
+
placeholder={`${t('PUBLISHABLE_KEY', 'Publishable key')} (${t('SANDBOX', 'Sandbox')})`}
|
|
246
|
+
onChange={e => handleChangeInput(e, true)}
|
|
247
|
+
/>
|
|
248
|
+
<FieldName>{t('SECRECT_KEY', 'Secret key')} ({t('SANDBOX', 'Sandbox')})</FieldName>
|
|
249
|
+
<Input
|
|
250
|
+
name='secret'
|
|
251
|
+
defaultValue={
|
|
252
|
+
changesState?.data_sandbox?.secret
|
|
253
|
+
? changesState?.data_sandbox?.secret
|
|
254
|
+
: businessPaymethod?.data_sandbox?.secret
|
|
255
|
+
}
|
|
256
|
+
placeholder={`${t('SECRECT_KEY', 'Secret key')} (${t('SANDBOX', 'Sandbox')})`}
|
|
257
|
+
onChange={e => handleChangeInput(e, true)}
|
|
258
|
+
/>
|
|
259
|
+
<p className='alert-message'>{t('TWILIO_CONFIGURATION_MESSAGE', '*Enable these options after twilio configuration')}</p>
|
|
260
|
+
{!configsState?.loading && configsState?.configs?.filter(config => configsToShow[config?.key]).map(config => {
|
|
261
|
+
const options = config?.options?.map(item => {
|
|
262
|
+
return { value: item.value, content: <Option>{t(item.text.toUpperCase())}</Option> }
|
|
263
|
+
})
|
|
264
|
+
return (
|
|
265
|
+
<>
|
|
266
|
+
<FieldName>{config?.name}</FieldName>
|
|
267
|
+
{config?.type === 2 && options && (
|
|
268
|
+
<Select
|
|
269
|
+
notAsync
|
|
270
|
+
defaultValue={config?.value}
|
|
271
|
+
options={options}
|
|
272
|
+
onChange={(typeValue) => handleUpdateConfigs(config?.id, { value: typeValue })}
|
|
273
|
+
placeholder={t('SELECT_A_OPTION', 'Select a option')}
|
|
274
|
+
/>
|
|
275
|
+
)}
|
|
276
|
+
</>
|
|
277
|
+
)
|
|
278
|
+
})}
|
|
279
|
+
</>
|
|
280
|
+
)}
|
|
281
|
+
|
|
282
|
+
{paymentTabs === 1 && sitesState?.sites?.length > 0 && (
|
|
283
|
+
<>
|
|
284
|
+
<TabOption
|
|
285
|
+
key='all'
|
|
286
|
+
onClick={() => setPaymethodInfo({ key: 'sites', value: 'All' })}
|
|
287
|
+
>
|
|
288
|
+
{all ? (
|
|
289
|
+
<RiCheckboxFill className='fill' />
|
|
290
|
+
) : (
|
|
291
|
+
<RiCheckboxBlankLine />
|
|
292
|
+
)}
|
|
293
|
+
<TabOptionName>{t('ALL', 'All')}</TabOptionName>
|
|
294
|
+
</TabOption>
|
|
295
|
+
{!all && sitesState?.sites.map(site => (
|
|
296
|
+
<TabOption
|
|
297
|
+
key={site.id}
|
|
298
|
+
onClick={() => setPaymethodInfo({ key: 'sites', value: site.id })}
|
|
299
|
+
>
|
|
300
|
+
{(localState?.sites ?? businessPaymethod?.sites?.map(s => s.id))?.includes(site.id) ? (
|
|
301
|
+
<RiCheckboxFill className='fill' />
|
|
302
|
+
) : (
|
|
303
|
+
<RiCheckboxBlankLine />
|
|
304
|
+
)}
|
|
305
|
+
<TabOptionName>{site.name}</TabOptionName>
|
|
306
|
+
</TabOption>
|
|
307
|
+
))}
|
|
308
|
+
</>
|
|
309
|
+
)}
|
|
310
|
+
|
|
311
|
+
{paymentTabs === 2 && (
|
|
312
|
+
orderTypes.map(type => (
|
|
313
|
+
<TabOption
|
|
314
|
+
key={type.value}
|
|
315
|
+
onClick={() => setPaymethodInfo({ key: 'allowed_order_types', value: type.value })}
|
|
316
|
+
>
|
|
317
|
+
{(localState?.allowed_order_types ?? businessPaymethod?.allowed_order_types)?.includes(type.value) ? (
|
|
318
|
+
<RiCheckboxFill className='fill' />
|
|
319
|
+
) : (
|
|
320
|
+
<RiCheckboxBlankLine />
|
|
321
|
+
)}
|
|
322
|
+
<TabOptionName>{type.text}</TabOptionName>
|
|
323
|
+
</TabOption>
|
|
324
|
+
))
|
|
325
|
+
)}
|
|
326
|
+
|
|
327
|
+
<Button
|
|
328
|
+
borderRadius='5px'
|
|
329
|
+
color='primary'
|
|
330
|
+
disabled={actionState.loading || Object.keys(changesState).length === 0}
|
|
331
|
+
onClick={() => handleSaveClick(businessPaymethod.id)}
|
|
332
|
+
>
|
|
333
|
+
{actionState.loading ? t('LOADING', 'Loading') : t('SAVE', 'Save')}
|
|
334
|
+
</Button>
|
|
335
|
+
</Container>
|
|
336
|
+
<Confirm
|
|
337
|
+
width='700px'
|
|
338
|
+
title={t('WEB_APPNAME', 'Ordering')}
|
|
339
|
+
content={confirm.content}
|
|
340
|
+
acceptText={t('ACCEPT', 'Accept')}
|
|
341
|
+
open={confirm.open}
|
|
342
|
+
onClose={() => setConfirm({ ...confirm, open: false })}
|
|
343
|
+
onCancel={() => setConfirm({ ...confirm, open: false })}
|
|
344
|
+
onAccept={confirm.handleOnAccept}
|
|
345
|
+
closeOnBackdrop={false}
|
|
346
|
+
/>
|
|
347
|
+
</>
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export const PaymentOptionStripeLink = (props) => {
|
|
352
|
+
const paymentOptionStripeLinkProps = {
|
|
353
|
+
...props,
|
|
354
|
+
UIComponent: PaymentOptionStripeLinkUI
|
|
355
|
+
}
|
|
356
|
+
return <PaymentOptionStripeLinkController {...paymentOptionStripeLinkProps} />
|
|
357
|
+
}
|