ordering-ui-admin-external 1.5.0 → 1.6.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 (163) hide show
  1. package/_bundles/{ordering-ui-admin.d4ee01fd9abda5a6348f.js → ordering-ui-admin.0fd83f227d29409cb170.js} +2 -2
  2. package/_bundles/{ordering-ui-admin.d4ee01fd9abda5a6348f.js.LICENSE.txt → ordering-ui-admin.0fd83f227d29409cb170.js.LICENSE.txt} +1 -1
  3. package/_modules/components/Delivery/UserFormDetails/index.js +10 -3
  4. package/_modules/components/Login/LoginForm/index.js +4 -3
  5. package/_modules/components/Login/ResetPassword/index.js +251 -0
  6. package/_modules/components/Login/ResetPassword/styles.js +64 -0
  7. package/_modules/components/Login/index.js +8 -1
  8. package/_modules/components/Marketing/CampaignDetailContent/index.js +41 -5
  9. package/_modules/components/Marketing/CampaignDetailGeneral/index.js +2 -2
  10. package/_modules/components/Marketing/CampaignEmail/index.js +155 -12
  11. package/_modules/components/Marketing/CampaignEmail/styles.js +18 -4
  12. package/_modules/components/Marketing/CampaignHeader/index.js +11 -1
  13. package/_modules/components/Marketing/CampaignHeader/styles.js +25 -6
  14. package/_modules/components/Marketing/CampaignList/index.js +41 -25
  15. package/_modules/components/Marketing/CampaignNotification/index.js +14 -1
  16. package/_modules/components/Marketing/CampaignNotification/styles.js +7 -3
  17. package/_modules/components/Marketing/CampaignSMS/index.js +14 -1
  18. package/_modules/components/Marketing/CampaignSMS/styles.js +7 -3
  19. package/_modules/components/Marketing/CampaignWebHook/index.js +13 -1
  20. package/_modules/components/Marketing/CampaignWebHook/styles.js +7 -3
  21. package/_modules/components/MyProducts/BoxLayout/index.js +20 -0
  22. package/_modules/components/MyProducts/BoxLayout/styles.js +22 -0
  23. package/_modules/components/MyProducts/CustomerApp/index.js +48 -0
  24. package/_modules/components/MyProducts/CustomerApp/styles.js +25 -0
  25. package/_modules/components/MyProducts/DriverApp/index.js +69 -0
  26. package/_modules/components/MyProducts/DriverApp/styles.js +29 -0
  27. package/_modules/components/MyProducts/OrderingWebsite/index.js +40 -0
  28. package/_modules/components/MyProducts/OrderingWebsite/styles.js +29 -0
  29. package/_modules/components/MyProducts/StoreApp/index.js +69 -0
  30. package/_modules/components/MyProducts/StoreApp/styles.js +29 -0
  31. package/_modules/components/MyProducts/index.js +33 -0
  32. package/_modules/components/OrderingProducts/OrderingProductDetails/index.js +4 -4
  33. package/_modules/components/Orders/OrdersTable/index.js +8 -9
  34. package/_modules/components/Profile/ProfilePage/index.js +70 -0
  35. package/_modules/components/Profile/ProfilePage/styles.js +22 -0
  36. package/_modules/components/Profile/index.js +12 -0
  37. package/_modules/components/Settings/InsertLink/index.js +3 -2
  38. package/_modules/components/Settings/PluginList/index.js +31 -1
  39. package/_modules/components/Settings/SettingsSelectUI/index.js +1 -1
  40. package/_modules/components/Shared/ColumnAllowSettingPopover/index.js +4 -3
  41. package/_modules/components/SidebarMenu/index.js +82 -55
  42. package/_modules/components/SidebarMenu/styles.js +3 -1
  43. package/_modules/components/Stores/BusinessLocation/index.js +1 -1
  44. package/_modules/components/Stores/BusinessProductAddForm/index.js +4 -4
  45. package/_modules/components/Stores/BusinessProductsListing/index.js +7 -0
  46. package/_modules/components/Stores/BusinessWebhooks/index.js +2 -2
  47. package/_modules/components/Stores/PaymentOption/index.js +23 -4
  48. package/_modules/components/Stores/PaymentOptionMethods/index.js +23 -4
  49. package/_modules/components/Stores/PaymentOptionPaypal/index.js +23 -4
  50. package/_modules/components/Stores/PaymentOptionStripeDirect/index.js +23 -4
  51. package/_modules/components/Stores/PaymethodOptionPaypalExpress/index.js +23 -4
  52. package/_modules/components/Stores/PaymethodOptionStripeConnect/index.js +23 -4
  53. package/_modules/components/Stores/PaymethodOptionStripeRedirect/index.js +23 -4
  54. package/_modules/components/Users/CustomerDetails/index.js +8 -10
  55. package/_modules/components/Users/CustomersListing/index.js +4 -2
  56. package/_modules/components/Users/OccupationSelector/index.js +48 -0
  57. package/_modules/components/Users/OccupationSelector/styles.js +16 -0
  58. package/_modules/components/Users/OccupationsFilter/index.js +49 -0
  59. package/_modules/components/Users/OccupationsFilter/styles.js +22 -0
  60. package/_modules/components/Users/ProfessionalDetail/index.js +47 -8
  61. package/_modules/components/Users/ProfessionalDetail/styles.js +10 -5
  62. package/_modules/components/Users/ProfessionalList/index.js +43 -6
  63. package/_modules/components/Users/ProfessionalList/styles.js +5 -3
  64. package/_modules/components/Users/ProfessionalListing/index.js +14 -3
  65. package/_modules/components/Users/ProfessionalSchedule/styles.js +1 -1
  66. package/_modules/components/Users/UserDetails/index.js +11 -13
  67. package/_modules/components/Users/UserFormDetails/index.js +8 -1
  68. package/_modules/components/Users/UserTypeSelector/index.js +7 -0
  69. package/_modules/components/Users/UsersList/index.js +40 -5
  70. package/_modules/components/Users/UsersList/styles.js +7 -5
  71. package/_modules/components/Users/UsersListing/index.js +4 -2
  72. package/_modules/contexts/ThemeContext/index.js +1 -1
  73. package/_modules/index.js +38 -0
  74. package/index-template.js +22 -4
  75. package/package.json +2 -2
  76. package/src/components/Delivery/UserFormDetails/index.js +8 -10
  77. package/src/components/Login/LoginForm/index.js +23 -20
  78. package/src/components/Login/ResetPassword/index.js +283 -0
  79. package/src/components/Login/ResetPassword/styles.js +215 -0
  80. package/src/components/Login/index.js +3 -1
  81. package/src/components/Marketing/CampaignDetail/index.js +0 -1
  82. package/src/components/Marketing/CampaignDetailContent/index.js +54 -24
  83. package/src/components/Marketing/CampaignDetailGeneral/index.js +1 -1
  84. package/src/components/Marketing/CampaignEmail/index.js +152 -15
  85. package/src/components/Marketing/CampaignEmail/styles.js +64 -3
  86. package/src/components/Marketing/CampaignHeader/index.js +19 -3
  87. package/src/components/Marketing/CampaignHeader/styles.js +77 -0
  88. package/src/components/Marketing/CampaignList/index.js +75 -65
  89. package/src/components/Marketing/CampaignNotification/index.js +11 -3
  90. package/src/components/Marketing/CampaignNotification/styles.js +13 -0
  91. package/src/components/Marketing/CampaignSMS/index.js +11 -2
  92. package/src/components/Marketing/CampaignSMS/styles.js +13 -0
  93. package/src/components/Marketing/CampaignWebHook/index.js +11 -2
  94. package/src/components/Marketing/CampaignWebHook/styles.js +13 -0
  95. package/src/components/MyProducts/BoxLayout/index.js +25 -0
  96. package/src/components/MyProducts/BoxLayout/styles.js +78 -0
  97. package/src/components/MyProducts/CustomerApp/index.js +52 -0
  98. package/src/components/MyProducts/CustomerApp/styles.js +59 -0
  99. package/src/components/MyProducts/DriverApp/index.js +83 -0
  100. package/src/components/MyProducts/DriverApp/styles.js +104 -0
  101. package/src/components/MyProducts/OrderingWebsite/index.js +41 -0
  102. package/src/components/MyProducts/OrderingWebsite/styles.js +104 -0
  103. package/src/components/MyProducts/StoreApp/index.js +83 -0
  104. package/src/components/MyProducts/StoreApp/styles.js +104 -0
  105. package/src/components/MyProducts/index.js +11 -0
  106. package/src/components/OrderingProducts/OrderingProductDetails/index.js +1 -1
  107. package/src/components/Orders/OrdersTable/index.js +3 -6
  108. package/src/components/Profile/ProfilePage/index.js +81 -0
  109. package/src/components/Profile/ProfilePage/styles.js +64 -0
  110. package/src/components/Profile/index.js +5 -0
  111. package/src/components/Settings/InsertLink/index.js +6 -2
  112. package/src/components/Settings/PluginList/index.js +2 -2
  113. package/src/components/Settings/SettingsSelectUI/index.js +1 -1
  114. package/src/components/Shared/ColumnAllowSettingPopover/index.js +11 -7
  115. package/src/components/SidebarMenu/index.js +120 -58
  116. package/src/components/SidebarMenu/styles.js +7 -0
  117. package/src/components/Stores/BusinessLocation/index.js +1 -1
  118. package/src/components/Stores/BusinessProductAddForm/index.js +2 -2
  119. package/src/components/Stores/BusinessProductsListing/index.js +8 -0
  120. package/src/components/Stores/BusinessWebhooks/index.js +2 -2
  121. package/src/components/Stores/PaymentOption/index.js +12 -2
  122. package/src/components/Stores/PaymentOptionMethods/index.js +12 -2
  123. package/src/components/Stores/PaymentOptionPaypal/index.js +12 -2
  124. package/src/components/Stores/PaymentOptionStripeDirect/index.js +12 -2
  125. package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +12 -2
  126. package/src/components/Stores/PaymethodOptionStripeConnect/index.js +12 -2
  127. package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +12 -2
  128. package/src/components/Users/CustomerDetails/index.js +1 -1
  129. package/src/components/Users/CustomersListing/index.js +3 -1
  130. package/src/components/Users/OccupationSelector/index.js +37 -0
  131. package/src/components/Users/OccupationSelector/styles.js +18 -0
  132. package/src/components/Users/OccupationsFilter/index.js +50 -0
  133. package/src/components/Users/OccupationsFilter/styles.js +32 -0
  134. package/src/components/Users/ProfessionalDetail/index.js +42 -7
  135. package/src/components/Users/ProfessionalDetail/styles.js +16 -2
  136. package/src/components/Users/ProfessionalList/index.js +41 -3
  137. package/src/components/Users/ProfessionalList/styles.js +5 -0
  138. package/src/components/Users/ProfessionalListing/index.js +14 -1
  139. package/src/components/Users/ProfessionalSchedule/styles.js +1 -0
  140. package/src/components/Users/UserDetails/index.js +1 -1
  141. package/src/components/Users/UserFormDetails/index.js +11 -2
  142. package/src/components/Users/UserTypeSelector/index.js +6 -0
  143. package/src/components/Users/UsersList/index.js +44 -8
  144. package/src/components/Users/UsersList/styles.js +7 -2
  145. package/src/components/Users/UsersListing/index.js +4 -2
  146. package/src/contexts/ThemeContext/index.js +4 -0
  147. package/src/index.js +17 -1
  148. package/template/app.js +55 -3
  149. package/template/assets/images/myProducts/customer-app.png +0 -0
  150. package/template/assets/images/myProducts/driver-app.png +0 -0
  151. package/template/assets/images/myProducts/ordering-website.png +0 -0
  152. package/template/assets/images/myProducts/store-app.png +0 -0
  153. package/template/components/ListenPageChanges/index.js +7 -1
  154. package/template/config.json +2 -1
  155. package/template/helmetdata.json +49 -0
  156. package/template/pages/CustomerApp/index.js +12 -0
  157. package/template/pages/DriverApp/index.js +12 -0
  158. package/template/pages/Login/index.js +7 -1
  159. package/template/pages/OrderingWebsite/index.js +12 -0
  160. package/template/pages/Professionals/index.js +2 -1
  161. package/template/pages/Profile/index.js +12 -0
  162. package/template/pages/ResetPassword/index.js +42 -0
  163. package/template/pages/StoreApp/index.js +12 -0
@@ -1,7 +1,16 @@
1
- import React, { useState } from 'react'
2
- import { useLanguage } from 'ordering-components-admin-external'
3
- import { Input, TextArea, Button } from '../../../styles'
4
- import { Alert } from '../../Shared'
1
+ import React, { useState, useEffect } from 'react'
2
+ import { useLanguage, useEvent, CampaignEmail as CampaignEmailController } from 'ordering-components-admin-external'
3
+ import { Input, Button } from '../../../styles'
4
+ import $ from 'jquery'
5
+ import ReactSummernote from 'react-summernote'
6
+ import 'react-summernote/dist/react-summernote.css'
7
+ import 'bootstrap/js/dist/modal'
8
+ import 'bootstrap/js/dist/dropdown'
9
+ import 'bootstrap/js/dist/tooltip'
10
+ import 'bootstrap/dist/css/bootstrap.css'
11
+ import { Alert, Modal } from '../../Shared'
12
+ import { InsertImage } from '../../Settings/InsertImage'
13
+ import { InsertLink } from '../../Settings/InsertLink'
5
14
  import {
6
15
  Container,
7
16
  InputWrapper,
@@ -9,21 +18,40 @@ import {
9
18
  EmailPreviewHeader,
10
19
  PointGroup,
11
20
  EmailPreviewContent,
12
- ButtonWrapper
21
+ ButtonWrapper,
22
+ WrapperEditor,
23
+ Preview,
24
+ Description
13
25
  } from './styles'
14
26
 
15
- export const CampaignEmail = (props) => {
27
+ const CampaignEmailUI = (props) => {
16
28
  const {
17
29
  isAddMode,
18
30
  contactState,
19
31
  handleChangeData,
20
32
  handleUpdateContact,
21
33
  handleAddCampaign,
22
- formState
34
+ formState,
35
+ handleChangeContact,
36
+ imageListState,
37
+ insertImageState,
38
+ handleInsertImage,
39
+ handleDeleteImage,
40
+ selectedImageUrl,
41
+ setSelectedImageUrl
23
42
  } = props
24
43
 
25
44
  const [, t] = useLanguage()
45
+ const [events] = useEvent()
26
46
  const [alertState, setAlertState] = useState({ open: false, content: [] })
47
+ const [openModal, setOpenModal] = useState(null)
48
+ const [editorContext, setEditorContext] = useState(null)
49
+ const [emailBody, setEmailBody] = useState(null)
50
+
51
+ const handleCloseModal = () => {
52
+ setOpenModal(false)
53
+ setEditorContext(null)
54
+ }
27
55
 
28
56
  const closeAlert = () => {
29
57
  setAlertState({
@@ -73,26 +101,95 @@ export const CampaignEmail = (props) => {
73
101
  }
74
102
  }
75
103
 
104
+ const handleRestoreEditor = () => editorContext.invoke('restoreRange')
105
+
106
+ const insertImage = (context) => {
107
+ const ui = $.summernote.ui
108
+ const button = ui.button({
109
+ contents: '<i class="note-icon-picture"/>',
110
+ tooltip: 'picture',
111
+ class: 'note-btn',
112
+ click: () => {
113
+ setEditorContext(context)
114
+ context.invoke('editor.saveRange')
115
+ setOpenModal('image')
116
+ }
117
+ })
118
+ return button.render()
119
+ }
120
+
121
+ const insertLink = (context) => {
122
+ const ui = $.summernote.ui
123
+ const button = ui.button({
124
+ contents: '<button style="background: #2C7BE5; border: none; font-size: 12px; color: white;">BUTTON</button>',
125
+ tooltip: 'link-button',
126
+ class: 'note-btn',
127
+ click: () => {
128
+ setEditorContext(context)
129
+ context.invoke('editor.saveRange')
130
+ setOpenModal('link')
131
+ }
132
+ })
133
+ return button.render()
134
+ }
135
+
136
+ const handleGoToPage = () => {
137
+ events.emit('go_to_page', { page: 'operation_settings', search: '?category=10' })
138
+ }
139
+
140
+ useEffect(() => {
141
+ if (!emailBody) return
142
+ handleChangeContact('body', emailBody)
143
+ }, [emailBody])
144
+
76
145
  return (
77
146
  <>
78
147
  <Container>
148
+ <Description>
149
+ {t('SMTP_SETTINGS_LINK_DESC', 'You need to complete SMTP configuration first, you can do it here:')} <span onClick={() => handleGoToPage()}>{t('EMAIL_SETTINGS', 'Email settings')}</span>
150
+ </Description>
79
151
  <InputWrapper>
80
152
  <label>{t('TITLE', 'Title')}</label>
81
153
  <Input
82
154
  name='title'
83
155
  placeholder={t('TITLE', 'Title')}
84
- defaultValue={contactState?.changes?.contact_data?.title || ''}
156
+ value={contactState?.changes?.contact_data?.title || ''}
85
157
  onChange={handleChangeData}
86
158
  />
87
159
  </InputWrapper>
88
160
  <InputWrapper>
89
161
  <label>{t('MESSAGES', 'Messages')}</label>
90
- <TextArea
91
- name='body'
92
- placeholder={t('WRITE_MESSAGE', 'Write a message')}
93
- defaultValue={contactState?.changes?.contact_data?.body || ''}
94
- onChange={handleChangeData}
95
- />
162
+ <WrapperEditor>
163
+ <ReactSummernote
164
+ value={contactState?.changes?.contact_data?.body ?? '<p><br></p>'}
165
+ placeholder={t('EMAIL_CONTENT', 'Email content')}
166
+ onInit={({ summernote }) => summernote('code', (contactState?.changes?.contact_data?.body ?? '<p><br></p>'))}
167
+ options={{
168
+ height: 350,
169
+ fontNames: ['Arial', 'Arial Black', 'Comic Sans MS', 'Courier New'],
170
+ toolbar: [
171
+ ['style', ['style']],
172
+ ['font', ['bold', 'italic', 'underline', 'clear']],
173
+ ['fontsize', ['fontsize']],
174
+ ['color', ['color']],
175
+ ['para', ['ul', 'paragraph']],
176
+ ['table', ['table']],
177
+ ['insert', ['insertLink', 'insertImage']],
178
+ ['codeview', ['codeview']]
179
+ ],
180
+ buttons: {
181
+ insertLink: insertLink,
182
+ insertImage: insertImage
183
+ },
184
+ popover: {
185
+ link: [
186
+ ['link', ['linkDialogShow']]
187
+ ]
188
+ }
189
+ }}
190
+ onChange={content => setEmailBody(content)}
191
+ />
192
+ </WrapperEditor>
96
193
  </InputWrapper>
97
194
  <EmailPreviewWrapper>
98
195
  <EmailPreviewHeader>
@@ -104,7 +201,10 @@ export const CampaignEmail = (props) => {
104
201
  </EmailPreviewHeader>
105
202
  <EmailPreviewContent>
106
203
  <h2>{contactState?.changes?.contact_data?.title || ''}</h2>
107
- <p>{contactState?.changes?.contact_data?.body || ''}</p>
204
+ <Preview
205
+ dangerouslySetInnerHTML={{ __html: contactState?.changes?.contact_data?.body || '' }}
206
+ />
207
+ {/* <p>{contactState?.changes?.contact_data?.body || ''}</p> */}
108
208
  </EmailPreviewContent>
109
209
  </EmailPreviewWrapper>
110
210
  </Container>
@@ -117,6 +217,35 @@ export const CampaignEmail = (props) => {
117
217
  {isAddMode ? t('ADD', 'Add') : t('SAVE', 'Save')}
118
218
  </Button>
119
219
  </ButtonWrapper>
220
+ <Modal
221
+ width='60%'
222
+ open={openModal === 'image'}
223
+ onClose={() => setOpenModal(null)}
224
+ >
225
+ <InsertImage
226
+ imageListState={imageListState}
227
+ editorContext={editorContext}
228
+ handleRestoreEditor={handleRestoreEditor}
229
+ onClose={() => handleCloseModal()}
230
+ insertImageState={insertImageState}
231
+ handleInsertImage={handleInsertImage}
232
+ handleDeleteImage={handleDeleteImage}
233
+ selectedImageUrl={selectedImageUrl}
234
+ setSelectedImageUrl={setSelectedImageUrl}
235
+ />
236
+ </Modal>
237
+ <Modal
238
+ width='60%'
239
+ open={openModal === 'link'}
240
+ onClose={() => setOpenModal(null)}
241
+ >
242
+ <InsertLink
243
+ editorContext={editorContext}
244
+ handleRestoreEditor={handleRestoreEditor}
245
+ onClose={() => handleCloseModal()}
246
+ isLinkButton
247
+ />
248
+ </Modal>
120
249
  <Alert
121
250
  title={t('CAMPAIGN', 'Campaign')}
122
251
  content={alertState.content}
@@ -129,3 +258,11 @@ export const CampaignEmail = (props) => {
129
258
  </>
130
259
  )
131
260
  }
261
+
262
+ export const CampaignEmail = (props) => {
263
+ const campaignEmailProps = {
264
+ ...props,
265
+ UIComponent: CampaignEmailUI
266
+ }
267
+ return <CampaignEmailController {...campaignEmailProps} />
268
+ }
@@ -3,15 +3,15 @@ import styled, { css } from 'styled-components'
3
3
  export const Container = styled.div``
4
4
 
5
5
  export const InputWrapper = styled.div`
6
- label {
6
+ > label {
7
7
  margin-bottom: 10px;
8
8
  font-size: 14px;
9
9
  line-height: 24px;
10
10
  }
11
- input, textarea {
11
+ > input, textarea {
12
12
  width: 100%;
13
13
  }
14
- textarea {
14
+ > textarea {
15
15
  height: 80px;
16
16
  }
17
17
  margin-bottom: 35px;
@@ -84,3 +84,64 @@ export const ButtonWrapper = styled.div`
84
84
  border-radius: 8px;
85
85
  }
86
86
  `
87
+
88
+ export const WrapperEditor = styled.div`
89
+ .note-editor {
90
+ border-radius: 8px;
91
+ border: 1px solid ${props => props.theme.colors.borderColor};
92
+
93
+ .note-toolbar {
94
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
95
+ }
96
+
97
+ .note-btn {
98
+ &:hover,
99
+ &:focus {
100
+ background-color: ${props => props.theme.colors.secundaryDarkContrast};
101
+ box-shadow: none;
102
+ }
103
+ }
104
+
105
+ .note-dropdown-menu {
106
+ a {
107
+ color: #000;
108
+ }
109
+
110
+ h1 {
111
+ font-size: 36px;
112
+ }
113
+ }
114
+ }
115
+ .modal-header .close {
116
+ padding: 0px !important;
117
+ margin: 0px !important;
118
+ }
119
+ .modal-header {
120
+ align-items: center !important;
121
+ }
122
+ .checkbox input {
123
+ margin-right: 10px;
124
+ margin-top: 3px;
125
+ }
126
+ .modal-body {
127
+ > div:first-child {
128
+ display: none;
129
+ }
130
+ }
131
+ `
132
+ export const Preview = styled.div`
133
+ overflow: hidden;
134
+ `
135
+
136
+ export const Description = styled.div`
137
+ font-size: 14px;
138
+ margin: 10px 0px;
139
+ span {
140
+ color: ${props => props.theme.colors.primary};
141
+ cursor: pointer;
142
+ transition: all 0.3s linear;
143
+ &:hover {
144
+ text-decoration: underline;
145
+ }
146
+ }
147
+ `
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
- import { useLanguage } from 'ordering-components-admin-external'
2
+ import { useLanguage, useSession } from 'ordering-components-admin-external'
3
3
  import { useInfoShare } from '../../../contexts/InfoShareContext'
4
- import { List as MenuIcon } from 'react-bootstrap-icons'
4
+ import { List as MenuIcon, InfoCircle } from 'react-bootstrap-icons'
5
5
  import { SearchBar } from '../../Shared'
6
6
  import { Button, IconButton } from '../../../styles'
7
7
 
@@ -10,7 +10,9 @@ import {
10
10
  HeaderSection,
11
11
  HeaderTitle,
12
12
  TopRightSection,
13
- WrapperSearch
13
+ WrapperSearch,
14
+ InfoWrapper,
15
+ InfoContent
14
16
  } from './styles'
15
17
 
16
18
  export const CampaignHeader = (props) => {
@@ -21,6 +23,7 @@ export const CampaignHeader = (props) => {
21
23
  } = props
22
24
 
23
25
  const [, t] = useLanguage()
26
+ const [sessionState] = useSession()
24
27
  const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
25
28
 
26
29
  return (
@@ -35,6 +38,19 @@ export const CampaignHeader = (props) => {
35
38
  </IconButton>
36
39
  )}
37
40
  <HeaderTitle>{t('CAMPAIGN', 'Campaign')}</HeaderTitle>
41
+ {sessionState?.user?.level === 0 && (
42
+ <InfoWrapper>
43
+ <IconButton
44
+ color='primary'
45
+ >
46
+ <InfoCircle />
47
+ </IconButton>
48
+ <InfoContent>
49
+ {t('MARKETING_INFO', 'Create campaigns to reach your customer with news, offers and new products. Need help with the set-up? Contact our team here:')}
50
+ <a href='https://www.ordering.co/support' target='_blank' rel='noopener noreferrer'>{t('CUSTOMER_SUPPORT', 'Customer support')}</a>
51
+ </InfoContent>
52
+ </InfoWrapper>
53
+ )}
38
54
  </HeaderSection>
39
55
  <TopRightSection>
40
56
  <WrapperSearch>
@@ -34,6 +34,83 @@ export const HeaderTitle = styled.p`
34
34
  width: calc(100% - 50px);
35
35
  }
36
36
  `
37
+
38
+ export const InfoWrapper = styled.div`
39
+ position: relative;
40
+ ${props => props.theme?.rtl ? css`
41
+ margin-left: -8px;
42
+ margin-right: 8px;
43
+ ` : css`
44
+ margin-right: -8px;
45
+ margin-left: 8px;
46
+ `}
47
+
48
+ > button {
49
+ height: 25px;
50
+ svg {
51
+ width: 16px;
52
+ height: 16px;
53
+ }
54
+ }
55
+ &:hover > div {
56
+ /* display: block; */
57
+ visibility: visible;
58
+ opacity: 1;
59
+ }
60
+ `
61
+
62
+ export const InfoContent = styled.div`
63
+ position: absolute;
64
+ top: 100%;
65
+ z-index: 999;
66
+ background: ${props => props.theme.colors.backgroundInfo};
67
+ border: 1px solid ${props => props.theme.colors.primary};
68
+ box-sizing: border-box;
69
+ box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.12);
70
+ border-radius: 7.6px;
71
+ padding: 8px 12px;
72
+ font-size: 12px;
73
+ line-height: 18px;
74
+ min-width: 150px;
75
+ transition: all 0.3s linear;
76
+ visibility: hidden;
77
+ opacity: 0;
78
+ /* display: none; */
79
+ right: 0px;
80
+ ${props => props.theme.rtl && css`
81
+ left: 0px;
82
+ right: initial;
83
+ `}
84
+
85
+ a {
86
+ color: ${props => props.theme.colors.primary};
87
+ transition: all 0.3s linear;
88
+ cursor: pointer;
89
+ margin-left: 5px;
90
+ ${props => props.theme.rtl && css`
91
+ margin-left: 0px;
92
+ margin-right: 5px;
93
+ `}
94
+ &:hover {
95
+ text-decoration: underline;
96
+ }
97
+ }
98
+
99
+ @media (min-width: 576px) {
100
+ min-width: 350px;
101
+ padding: 12px 15px;
102
+ left: 0px;
103
+ ${props => props.theme.rtl && css`
104
+ right: 0px;
105
+ left: initial;
106
+ `}
107
+ }
108
+
109
+ @media (min-width: 993px) {
110
+ min-width: 535px;
111
+ }
112
+ `
113
+
37
114
  export const TopRightSection = styled.div`
38
115
  width: 100%;
39
116
  display: flex;
@@ -32,11 +32,12 @@ export const CampaignList = (props) => {
32
32
  campaign: true,
33
33
  contact_type: true,
34
34
  audience: true,
35
- // sales_general: true,
36
- // open_rate: true,
37
- // click_rate: true,
38
- update: true,
39
- actions: true
35
+ sent_count: true,
36
+ open_count: true,
37
+ unsubscribed_count: true,
38
+ bounced_count: true
39
+ // update: true,
40
+ // actions: true
40
41
  })
41
42
 
42
43
  const optionsDefault = [
@@ -52,26 +53,30 @@ export const CampaignList = (props) => {
52
53
  value: 'audience',
53
54
  content: t('AUDIENCE', 'Audience')
54
55
  },
55
- // {
56
- // value: 'sales_general',
57
- // content: t('SALES_GENERAL', 'Sales general')
58
- // },
59
- // {
60
- // value: 'open_rate',
61
- // content: t('OPEN_RATE', 'Open rate')
62
- // },
63
- // {
64
- // value: 'click_rate',
65
- // content: t('CLICK_RATE', 'Click rate')
66
- // },
67
56
  {
68
- value: 'update',
69
- content: t('UPDATE', 'Update')
57
+ value: 'sent_count',
58
+ content: t('SENT', 'Sent')
59
+ },
60
+ {
61
+ value: 'open_count',
62
+ content: t('OPENS', 'Opens')
70
63
  },
71
64
  {
72
- value: 'actions',
73
- content: t('ACTIONS', 'Actions')
65
+ value: 'unsubscribed_count',
66
+ content: t('UNSUBSCRIBED', 'Unsubscribed')
67
+ },
68
+ {
69
+ value: 'bounced_count',
70
+ content: t('BOUNCES', 'Bounces')
74
71
  }
72
+ // {
73
+ // value: 'update',
74
+ // content: t('UPDATE', 'Update')
75
+ // },
76
+ // {
77
+ // value: 'actions',
78
+ // content: t('ACTIONS', 'Actions')
79
+ // }
75
80
  ]
76
81
 
77
82
  const checkColor = (status) => {
@@ -120,15 +125,18 @@ export const CampaignList = (props) => {
120
125
  {allowColumns?.audience && (
121
126
  <th>{t('AUDIENCE', 'Audience')}</th>
122
127
  )}
123
- {/* {allowColumns?.sales_general && (
124
- <th>{t('SALES_GENERAL', 'Sales general')}</th>
128
+ {allowColumns?.sent_count && (
129
+ <th>{t('SENT', 'Sent')}</th>
130
+ )}
131
+ {allowColumns?.open_count && (
132
+ <th>{t('OPENS', 'Opens')}</th>
125
133
  )}
126
- {allowColumns?.open_rate && (
127
- <th>{t('OPEN_RATE', 'Open rate')}</th>
134
+ {allowColumns?.unsubscribed_count && (
135
+ <th>{t('UNSUBSCRIBED', 'Unsubscribed')}</th>
136
+ )}
137
+ {allowColumns?.bounced_count && (
138
+ <th>{t('BOUNCES', 'Bounces')}</th>
128
139
  )}
129
- {allowColumns?.click_rate && (
130
- <th>{t('CLICK_RATE', 'Click rate')}</th>
131
- )} */}
132
140
  <th className='allow-colums action'>
133
141
  <ColumnAllowSettingPopover
134
142
  allowColumns={allowColumns}
@@ -158,21 +166,26 @@ export const CampaignList = (props) => {
158
166
  <Skeleton width={100} height={20} />
159
167
  </td>
160
168
  )}
161
- {/* {allowColumns?.sales_general && (
169
+ {allowColumns?.sent_count && (
170
+ <td>
171
+ <Skeleton width={100} height={20} />
172
+ </td>
173
+ )}
174
+ {allowColumns?.open_count && (
162
175
  <td>
163
- <Skeleton width={50} height={20} />
176
+ <Skeleton width={100} height={20} />
164
177
  </td>
165
178
  )}
166
- {allowColumns?.open_rate && (
179
+ {allowColumns?.unsubscribed_count && (
167
180
  <td>
168
- <Skeleton width={50} height={20} />
181
+ <Skeleton width={100} height={20} />
169
182
  </td>
170
183
  )}
171
- {allowColumns?.click_rate && (
184
+ {allowColumns?.bounced_count && (
172
185
  <td>
173
- <Skeleton width={50} height={20} />
186
+ <Skeleton width={100} height={20} />
174
187
  </td>
175
- )} */}
188
+ )}
176
189
  <td>
177
190
  <SwitchWrapper>
178
191
  <p className='campaign-enabled'><Skeleton width={80} height={20} /></p>
@@ -203,39 +216,36 @@ export const CampaignList = (props) => {
203
216
  {allowColumns?.audience && (
204
217
  <td>{campaign?.audience_type}</td>
205
218
  )}
206
- {/* {allowColumns?.sales_general && (
207
- <td>05</td>
219
+ {allowColumns?.sent_count && (
220
+ <td>{campaign?.sent_count}</td>
208
221
  )}
209
- {allowColumns?.open_rate && (
210
- <td>02</td>
222
+ {allowColumns?.open_count && (
223
+ <td>{campaign?.open_count}</td>
211
224
  )}
212
- {allowColumns?.click_rate && (
213
- <td className='right-border'>
214
- <div>
215
- <p>02</p>
216
- </div>
217
- </td>
218
- )} */}
219
- {(allowColumns?.update || allowColumns?.actions) && (
220
- <td>
221
- {allowColumns?.actions && campaign?.audience_type === 'dynamic' && (
222
- <SwitchWrapper>
223
- <p className='campaign-enabled'>{t('ENABLE', 'Enable')}</p>
224
- <Switch
225
- defaultChecked={campaign?.enabled}
226
- onChange={val => handleUpdateCampaign(campaign.id, { enabled: val })}
227
- className='enable_control'
228
- />
229
- </SwitchWrapper>
230
- )}
231
- {allowColumns?.update && campaign?.audience_type === 'fixed' && (
232
- <StatusWrapper>
233
- <p>{campaign?.status}</p>
234
- <StatusPoint style={{ background: checkColor(campaign?.status) }} />
235
- </StatusWrapper>
236
- )}
237
- </td>
225
+ {allowColumns?.unsubscribed_count && (
226
+ <td>{campaign?.unsubscribed_count}</td>
227
+ )}
228
+ {allowColumns?.bounced_count && (
229
+ <td>{campaign?.bounced_count}</td>
238
230
  )}
231
+ <td>
232
+ {campaign?.audience_type === 'dynamic' && (
233
+ <SwitchWrapper>
234
+ <p className='campaign-enabled'>{t('ENABLE', 'Enable')}</p>
235
+ <Switch
236
+ defaultChecked={campaign?.enabled}
237
+ onChange={val => handleUpdateCampaign(campaign.id, { enabled: val })}
238
+ className='enable_control'
239
+ />
240
+ </SwitchWrapper>
241
+ )}
242
+ {campaign?.audience_type === 'fixed' && (
243
+ <StatusWrapper>
244
+ <p>{campaign?.status}</p>
245
+ <StatusPoint style={{ background: checkColor(campaign?.status) }} />
246
+ </StatusWrapper>
247
+ )}
248
+ </td>
239
249
  </tr>
240
250
  </Tbody>
241
251
  ))
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import { useLanguage } from 'ordering-components-admin-external'
2
+ import { useLanguage, useEvent } from 'ordering-components-admin-external'
3
3
  import { Input, TextArea, Button } from '../../../styles'
4
4
  import { useTheme } from 'styled-components'
5
5
  import { Alert } from '../../Shared'
@@ -10,7 +10,8 @@ import {
10
10
  SmsPreviewWrapper,
11
11
  SmsContentLayout,
12
12
  SmsPreviewContentWrapper,
13
- SmsPreviewContent
13
+ SmsPreviewContent,
14
+ Description
14
15
  } from './styles'
15
16
 
16
17
  export const CampaignNotification = (props) => {
@@ -24,8 +25,8 @@ export const CampaignNotification = (props) => {
24
25
  } = props
25
26
 
26
27
  const [, t] = useLanguage()
27
-
28
28
  const theme = useTheme()
29
+ const [events] = useEvent()
29
30
  const [alertState, setAlertState] = useState({ open: false, content: [] })
30
31
 
31
32
  const closeAlert = () => {
@@ -76,9 +77,16 @@ export const CampaignNotification = (props) => {
76
77
  }
77
78
  }
78
79
 
80
+ const handleGoToPage = () => {
81
+ events.emit('go_to_page', { page: 'operation_settings', search: '?category=14' })
82
+ }
83
+
79
84
  return (
80
85
  <>
81
86
  <Container>
87
+ <Description>
88
+ {t('NOTIFICATION_SETTINGS_LINK_DESC', 'You need to complete One signal configuration first, you can do it here:')} <span onClick={() => handleGoToPage()}>{t('NOTIFICATION_SETTINGS', 'Notification settings')}</span>
89
+ </Description>
82
90
  <InputWrapper>
83
91
  <label>{t('TITLE', 'Title')}</label>
84
92
  <Input
@@ -93,3 +93,16 @@ export const SmsPreviewContent = styled.div`
93
93
  color: ${props => props.theme.colors.lightGray};
94
94
  }
95
95
  `
96
+
97
+ export const Description = styled.div`
98
+ font-size: 14px;
99
+ margin: 10px 0px;
100
+ span {
101
+ color: ${props => props.theme.colors.primary};
102
+ cursor: pointer;
103
+ transition: all 0.3s linear;
104
+ &:hover {
105
+ text-decoration: underline;
106
+ }
107
+ }
108
+ `