pager-widget 0.2.2 → 0.2.4

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/App.jsx CHANGED
@@ -3329,6 +3329,7 @@ const App = ({
3329
3329
  </ChatContentWrapper>
3330
3330
  </EndPointProvider>
3331
3331
  <Footer
3332
+ sourceState={sourceState}
3332
3333
  {...{ sendMessage, onFileUpload }}
3333
3334
  widget={widget}
3334
3335
  messages={messages}
@@ -3363,6 +3364,7 @@ const App = ({
3363
3364
  };
3364
3365
 
3365
3366
  const Footer = ({
3367
+ sourceState,
3366
3368
  sendMessage,
3367
3369
  widget,
3368
3370
  messages,
@@ -3417,7 +3419,8 @@ const Footer = ({
3417
3419
  </span>
3418
3420
  </p>
3419
3421
  )}
3420
- <InputMessageChat
3422
+ {console.log("3420", widget)}
3423
+ {sourceState !== "new_user" &&<InputMessageChat
3421
3424
  size={scale.widgetSize}
3422
3425
  className="widget_input_message"
3423
3426
  >
@@ -3477,7 +3480,7 @@ const Footer = ({
3477
3480
  </span>
3478
3481
  </div>
3479
3482
  </div>
3480
- </InputMessageChat>
3483
+ </InputMessageChat>}
3481
3484
 
3482
3485
  <div className="widget_footer">
3483
3486
  <p>
@@ -3946,6 +3949,7 @@ const ChatHeaderTop = ({ widget, onClick, open, restart, exit, logoshape }) => {
3946
3949
  </IconSpan> */}
3947
3950
  <div
3948
3951
  style={{
3952
+
3949
3953
  display: "flex",
3950
3954
  gap: "8px",
3951
3955
  }}
@@ -3956,8 +3960,9 @@ const ChatHeaderTop = ({ widget, onClick, open, restart, exit, logoshape }) => {
3956
3960
  color: `${widget.primary_color}`,
3957
3961
  background: `${widget.accent_color}`,
3958
3962
  border: "1px solid white",
3959
- padding: "10px 15px",
3963
+ padding: "6px 12px",
3960
3964
  borderRadius: "8px",
3965
+ height: "28px"
3961
3966
  }}
3962
3967
  >
3963
3968
  Restart
@@ -3989,8 +3994,9 @@ const ChatHeaderTop = ({ widget, onClick, open, restart, exit, logoshape }) => {
3989
3994
  color: `${widget.primary_color}`,
3990
3995
  background: `${widget.accent_color}`,
3991
3996
  border: "1px solid white",
3992
- padding: "10px 15px",
3997
+ padding: "6px 12px",
3993
3998
  borderRadius: "8px",
3999
+ height: "28px"
3994
4000
  }}
3995
4001
  >
3996
4002
  Exit
@@ -4155,6 +4161,7 @@ const FeedbackBtn = ({
4155
4161
  }) => {
4156
4162
  // const [hovered, setHovered] = useState(false);
4157
4163
  const scale = useScaleContext();
4164
+ console.log("labelll", label)
4158
4165
  return (
4159
4166
  <WidgetUpdateButton>
4160
4167
  <Button
@@ -4212,8 +4219,29 @@ const FeedbackBtn = ({
4212
4219
  strokeLinejoin="round"
4213
4220
  />
4214
4221
  </svg>
4215
- ) : (
4216
- <svg
4222
+ ) : null
4223
+ // (
4224
+ // <svg
4225
+ // xmlns="
4226
+ // http://www.w3.org/2000/svg"
4227
+ // viewBox="0 0 24 24"
4228
+ // fill="none"
4229
+ // width="24px"
4230
+ // height="24px"
4231
+ // >
4232
+ // <path
4233
+ // d="M16 11.0638V12.5C16 13.8807 17.1193 15 18.5 15C19.8807 15 21 13.8807 21 12.5V6.5C21 5.11929 19.8807 4 18.5 4C17.1193 4 16 5.11929 16 6.5V8.26803M16 11.0638C15.9981 11.8772 15.9848 12.3486 15.9004 12.8057C15.812 13.2848 15.6657 13.7513 15.4645 14.1949C15.2378 14.6948 14.9181 15.154 14.2787 16.0725L11.2669 20.3986C11.1903 20.5085 11.1521 20.5634 11.1167 20.6041C10.764 21.0097 10.1537 21.0639 9.73502 20.7268C9.69309 20.6931 9.64573 20.6457 9.55102 20.551C9.38747 20.3874 9.30569 20.3057 9.23586 20.2251C8.55824 19.4437 8.33094 18.3683 8.63439 17.3796C8.66566 17.2777 8.70737 17.1698 8.79074 16.954L8.83852 16.8304C8.97239 16.484 9.03932 16.3108 9.06475 16.1739C9.21585 15.3603 8.67951 14.578 7.86615 14.4256C7.72925 14.4 7.54357 14.4 7.17222 14.4H4.7857C3.82553 14.4 3.34542 14.4 3.00125 14.2049C2.69915 14.0336 2.46584 13.7628 2.34113 13.4387C2.19905 13.0694 2.27007 12.5946 2.4121 11.645L2.94384 8.08995C3.16087 6.63894 3.26938 5.91343 3.62294 5.36807C3.93452 4.88744 4.3772 4.50605 4.89864 4.26899C5.4903 4 6.22388 4 7.69103 4H11.2C12.8802 4 13.7203 4 14.362 4.32698C14.9265 4.6146 15.3854 5.07354 15.673 5.63803C15.9635 6.20815 15.9964 6.93482 16 8.26803M16 11.0638V8.26803"
4234
+ // stroke="#ED3535"
4235
+ // strokeWidth="1.7"
4236
+ // strokeLinecap="round"
4237
+ // strokeLinejoin="round"
4238
+ // />
4239
+ // </svg>
4240
+ // )
4241
+ }
4242
+ {
4243
+ label === "Not Satisfied"?(
4244
+ <svg
4217
4245
  xmlns="
4218
4246
  http://www.w3.org/2000/svg"
4219
4247
  viewBox="0 0 24 24"
@@ -4229,7 +4257,13 @@ const FeedbackBtn = ({
4229
4257
  strokeLinejoin="round"
4230
4258
  />
4231
4259
  </svg>
4232
- )}
4260
+ ):null
4261
+ }
4262
+ {
4263
+ label === "Hand over to Live agent"?(
4264
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" color="blue" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-hand-coins text-brand-primary w-4 h-4"><path d="M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17"></path><path d="m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9"></path><path d="m2 16 6 6"></path><circle cx="16" cy="9" r="2.9"></circle><circle cx="6" cy="5" r="3"></circle></svg>
4265
+ ):null
4266
+ }
4233
4267
  </Button>
4234
4268
  </WidgetUpdateButton>
4235
4269
  );
@@ -4244,6 +4278,7 @@ const AiFeedbackButtonsWrapper = ({
4244
4278
  return (
4245
4279
  <ButtonWrapper>
4246
4280
  {options.map(({ label, action }, key) => (
4281
+
4247
4282
  <FeedbackBtn
4248
4283
  label={label}
4249
4284
  action={action}
package/ConsentPopup.jsx CHANGED
@@ -193,9 +193,9 @@ console.log("url location", window.location.origin)
193
193
 
194
194
  }}>
195
195
  <button
196
-
196
+
197
197
  disabled={isVisible == false ? true : false}
198
- style={{...popupStyles.button, width: "90%", background:widget?.accent_color}}
198
+ style={{...popupStyles.button, width: "90%", background:isVisible === false ?"#E2E8F0":widget?.accent_color}}
199
199
  onClick={handleSubmit}
200
200
  >
201
201
  Submit
package/Dropdown.jsx CHANGED
@@ -5,6 +5,7 @@ import styled from "styled-components";
5
5
  const DropdownWrapper = styled.div`
6
6
  width: 100%;
7
7
  position: relative;
8
+
8
9
  `;
9
10
  const DropdownContent = styled.span`
10
11
  border-radius: 8px;
@@ -17,7 +18,7 @@ const DropdownContent = styled.span`
17
18
  padding: 10px 30px 10px 2px;
18
19
  cursor: pointer;
19
20
  width: 91%;
20
- height: 30px;
21
+ height: 24px;
21
22
  display: flex;
22
23
  justify-content: space-between;
23
24
  align-items: center;
@@ -39,7 +40,7 @@ const DropdownList = styled.div`
39
40
  `;
40
41
  const DropdownInput = styled.input`
41
42
  width: 100%;
42
- padding-left: 40px;
43
+ padding-left: 20px;
43
44
  border-bottom: 1px solid #d0d5dd;
44
45
  outline: none;
45
46
  border-top: none;
@@ -47,6 +48,8 @@ const DropdownInput = styled.input`
47
48
  border-right: none;
48
49
  background: transparent;
49
50
  height: 40px;
51
+
52
+
50
53
  `;
51
54
  const DropdownNode = styled.span`
52
55
  padding: 8px 8px;
@@ -101,7 +104,7 @@ const Dropdown = ({error,updateFieldValue, fieldId}) => {
101
104
  </DropdownContent>
102
105
  {isDropDownOpen && (
103
106
  <DropdownList>
104
- <DropdownInput onChange={(e) => setSearchQuery(e.target.value)} />
107
+ <DropdownInput onChange={(e) => setSearchQuery(e.target.value)} placeholder="search..." />
105
108
  <div
106
109
  style={{
107
110
  height: "220px",
@@ -16,7 +16,7 @@ const InputWrapper = styled.div`
16
16
  error === "true" ? "var(--red-300, #FFA2A2)" : "var(--k300, #d0d5dd)"};
17
17
  background: #fff;
18
18
  outline: none;
19
- height: 52px;
19
+ height: 44px;
20
20
  width: 100%;
21
21
  text-indent: 12px;
22
22
  padding-right: 40px; /* Space for icon */
@@ -230,13 +230,131 @@ const InputConverter = ({
230
230
  )
231
231
  );
232
232
 
233
+ // const handleChange = (e) => {
234
+ // const { id, value } = e.target;
235
+ // const newErrors = {};
236
+
237
+
238
+ // setFormValues((prev) => ({
239
+ // ...prev,
240
+ // [id]: value,
241
+ // }));
242
+
243
+ // formData.form_data.form_template.forEach((field) => {
244
+ // if (field.is_mandatory) {
245
+ // if (field.field_type === "country") {
246
+ // if (formValues.SYS_country === "") {
247
+ // newErrors[field.field_id] = `${field.name} is required`;
248
+ // }
249
+ // } else if (!formValues[field.field_id]?.trim()) {
250
+ // newErrors[field.field_id] = `${field.name} is required`;
251
+ // }
252
+ // }
253
+ // });
254
+
255
+ // if (Object.keys(newErrors).length > 0) {
256
+ // setErrors(newErrors);
257
+ // return;
258
+ // }
259
+
260
+ // setErrors({});
261
+
262
+ // };
263
+
264
+
265
+ // const handleChange = (e) => {
266
+ // const { id, value } = e.target;
267
+ // const newErrors = {};
268
+ // setFormValues((prev) => ({
269
+ // ...prev,
270
+ // [id]: value,
271
+ // }));
272
+
273
+
274
+
275
+ // formData.form_data.form_template.forEach((field) => {
276
+ // if (field.is_mandatory) {
277
+ // if (field.field_type === "country") {
278
+ // if (id === "SYS_country" && value === "") {
279
+ // newErrors[field.field_id] = `${field.name} is required`;
280
+ // }
281
+ // } else if (id === field.field_id && !value.trim()) {
282
+ // newErrors[field.field_id] = `${field.name} is required`;
283
+ // }
284
+ // }
285
+ // });
286
+
287
+ // setErrors(newErrors);
288
+ // };
289
+ // const handleChange = (e) => {
290
+ // const { id, value } = e.target;
291
+
292
+ // setFormValues((prev) => ({
293
+ // ...prev,
294
+ // [id]: value,
295
+ // }));
296
+
297
+ // // Validate all fields, not just the changed one
298
+ // const newErrors = {};
299
+
300
+ // formData.form_data.form_template.forEach((field) => {
301
+ // if (field.is_mandatory) {
302
+ // if (field.field_type === "country") {
303
+ // if (!formValues.SYS_country && id === "SYS_country" && value === "") {
304
+ // newErrors[field.field_id] = `${field.name} is required`;
305
+ // }
306
+ // } else if (!value.trim() && id === field.field_id) {
307
+ // newErrors[field.field_id] = `${field.name} is required`;
308
+ // } else if (!formValues[field.field_id]?.trim()) {
309
+ // newErrors[field.field_id] = `${field.name} is required`;
310
+ // }
311
+ // }
312
+ // });
313
+
314
+ // setErrors(newErrors);
315
+ // };
316
+
317
+
233
318
  const handleChange = (e) => {
234
319
  const { id, value } = e.target;
320
+
321
+ // Update form values
235
322
  setFormValues((prev) => ({
236
323
  ...prev,
237
324
  [id]: value,
238
325
  }));
326
+
327
+ // Re-validate all fields on every change
328
+ setErrors((prevErrors) => {
329
+ const newErrors = { ...prevErrors };
330
+
331
+ formData.form_data.form_template.forEach((field) => {
332
+ if (field.is_mandatory) {
333
+ if (field.field_type === "country") {
334
+ if (!formValues.SYS_country && id === "SYS_country" && value === "") {
335
+ newErrors[field.field_id] = `${field.name} is required`;
336
+ } else {
337
+ delete newErrors[field.field_id]; // Remove error when field is filled
338
+ }
339
+ } else {
340
+ if (id === field.field_id) {
341
+ if (!value.trim()) {
342
+ newErrors[field.field_id] = `${field.name} is required`;
343
+ } else {
344
+ delete newErrors[field.field_id]; // Remove error when field is filled
345
+ }
346
+ } else if (!formValues[field.field_id]?.trim()) {
347
+ newErrors[field.field_id] = `${field.name} is required`;
348
+ }
349
+ }
350
+ }
351
+ });
352
+
353
+ return newErrors;
354
+ });
239
355
  };
356
+
357
+
240
358
 
241
359
  const handleDropChange = (id) => (value) => {
242
360
  setFormValues((prev) => ({
Binary file