groovinads-ui 1.2.65 → 1.2.67

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "groovinads-ui",
3
3
  "description": "Groovinads UI is a React component library designed exclusively for Groovinads applications. It provides ready-to-use UI elements styled according to Groovinads design guidelines to facilitate rapid development.",
4
- "version": "1.2.65",
4
+ "version": "1.2.67",
5
5
  "keywords": [
6
6
  "css",
7
7
  "sass",
@@ -28,6 +28,7 @@ const Input = ({
28
28
  value,
29
29
  min,
30
30
  max,
31
+ maxLength,
31
32
  }) => {
32
33
  const { toCamelCase } = useTextFormatter();
33
34
  const inputRef = useRef(null);
@@ -103,6 +104,7 @@ const Input = ({
103
104
  ref={inputRef}
104
105
  min={min}
105
106
  max={max}
107
+ maxLength={maxLength}
106
108
  />
107
109
  <label htmlFor={id}>{label}</label>
108
110
  </div>
@@ -16,7 +16,6 @@ const InputEmail = ({
16
16
  textError = 'You must enter a valid email address',
17
17
  apiGetEmail,
18
18
  apiPostEmail,
19
- apiDeleteEmail,
20
19
  }) => {
21
20
  // STATE
22
21
  const [notifications, setNotifications] = useState([]);
@@ -32,6 +31,7 @@ const InputEmail = ({
32
31
  // GET, Returns a list of emails
33
32
  const fetchNotifications = async () => {
34
33
  const resp = await ComponentsService.getInfo(apiGetEmail);
34
+ console.log('resp', resp);
35
35
  setNotifications(resp || []);
36
36
 
37
37
  };
@@ -80,10 +80,16 @@ const InputEmail = ({
80
80
  // DELETE, Receives a list of emails
81
81
  const handleDeleteEmail = async (emailToDelete) => {
82
82
  setSelectedButton([...selectedButton, emailToDelete]);
83
- const resp = await ComponentsService.deleteEmails(
84
- apiDeleteEmail,
85
- emailToDelete,
83
+
84
+ const emailDeletedList = notifications.filter(
85
+ (email) => email !== emailToDelete,
86
+ )
87
+
88
+ const resp = await ComponentsService.postInfo(
89
+ apiPostEmail,
90
+ emailDeletedList,
86
91
  );
92
+
87
93
  setTimeout(() => {
88
94
  setSelectedButton(
89
95
  selectedButton.filter((email) => email !== emailToDelete),
@@ -126,10 +132,10 @@ const InputEmail = ({
126
132
  </div>
127
133
  </div>
128
134
  {/* SECTIONS LIST ADDED EMAILS */}
129
- {notifications.length ? (
135
+ {notifications?.length ? (
130
136
  <div className='shared-users-list'>
131
137
  <h3>{titleList}</h3>
132
- {notifications.map((email, index) => (
138
+ {notifications?.map((email, index) => (
133
139
  <div key={`email${index}`} className='shared-user-item'>
134
140
  <div className='shared-user'>
135
141
  <Icon iconName='user-circle' scale={2} />
@@ -161,7 +167,6 @@ InputEmail.propTypes = {
161
167
  showModal: PropTypes.bool,
162
168
  apiGetEmail: PropTypes.string.isRequired,
163
169
  apiPostEmail: PropTypes.string.isRequired,
164
- apiDeleteEmail: PropTypes.string.isRequired,
165
170
  titleList: PropTypes.string,
166
171
  label: PropTypes.string,
167
172
  textButton: PropTypes.string,
@@ -16,9 +16,8 @@ const Template = (args) => {
16
16
  {/* <Button size='lg' onClick={() => setShowModal(!showModal)}>Cambiar</Button> */}
17
17
  <InputEmail
18
18
  {...args}
19
- apiGetEmail={'v2/retail-media/retailers/settings/notifications'}
20
- apiPostEmail={'v2/retail-media/retailers/settings/notifications'}
21
- apiDeleteEmail={'v2/retail-media/retailers/settings/notifications'}
19
+ apiGetEmail={'v2/retail-media/brands/settings/notifications'}
20
+ apiPostEmail={'v2/retail-media/brands/settings/notifications'}
22
21
  // showModal={showModal}
23
22
  />
24
23
  </>