@sawport/react-sdk 0.1.0-alpha.34 → 0.1.0-alpha.35

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/dist/index.js CHANGED
@@ -6247,10 +6247,10 @@ function mapToCssModules(className, cssModule) {
6247
6247
  return cssModule[c2] || c2;
6248
6248
  }).join(" ");
6249
6249
  }
6250
- function omit(obj, omitKeys) {
6250
+ function omit(obj, omitKeys2) {
6251
6251
  var result = {};
6252
6252
  Object.keys(obj).forEach(function(key2) {
6253
- if (omitKeys.indexOf(key2) === -1) {
6253
+ if (omitKeys2.indexOf(key2) === -1) {
6254
6254
  result[key2] = obj[key2];
6255
6255
  }
6256
6256
  });
@@ -17452,7 +17452,7 @@ var reactTransitionGroup = {
17452
17452
  CSSTransition: _CSSTransition.default
17453
17453
  };
17454
17454
  var _excluded$b = ["tag", "baseClass", "baseClassActive", "className", "cssModule", "children", "innerRef"];
17455
- function ownKeys$7(object2, enumerableOnly) {
17455
+ function ownKeys$8(object2, enumerableOnly) {
17456
17456
  var keys5 = Object.keys(object2);
17457
17457
  if (Object.getOwnPropertySymbols) {
17458
17458
  var symbols = Object.getOwnPropertySymbols(object2);
@@ -17465,24 +17465,24 @@ function ownKeys$7(object2, enumerableOnly) {
17465
17465
  }
17466
17466
  return keys5;
17467
17467
  }
17468
- function _objectSpread$5(target) {
17468
+ function _objectSpread$6(target) {
17469
17469
  for (var i2 = 1; i2 < arguments.length; i2++) {
17470
17470
  var source = arguments[i2] != null ? arguments[i2] : {};
17471
17471
  if (i2 % 2) {
17472
- ownKeys$7(Object(source), true).forEach(function(key2) {
17472
+ ownKeys$8(Object(source), true).forEach(function(key2) {
17473
17473
  _defineProperty(target, key2, source[key2]);
17474
17474
  });
17475
17475
  } else if (Object.getOwnPropertyDescriptors) {
17476
17476
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
17477
17477
  } else {
17478
- ownKeys$7(Object(source)).forEach(function(key2) {
17478
+ ownKeys$8(Object(source)).forEach(function(key2) {
17479
17479
  Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));
17480
17480
  });
17481
17481
  }
17482
17482
  }
17483
17483
  return target;
17484
17484
  }
17485
- var propTypes$e = _objectSpread$5(_objectSpread$5({}, reactTransitionGroup.Transition.propTypes), {}, {
17485
+ var propTypes$e = _objectSpread$6(_objectSpread$6({}, reactTransitionGroup.Transition.propTypes), {}, {
17486
17486
  children: propTypes$i.exports.oneOfType([propTypes$i.exports.arrayOf(propTypes$i.exports.node), propTypes$i.exports.node]),
17487
17487
  tag: tagPropType,
17488
17488
  baseClass: propTypes$i.exports.string,
@@ -17491,7 +17491,7 @@ var propTypes$e = _objectSpread$5(_objectSpread$5({}, reactTransitionGroup.Trans
17491
17491
  cssModule: propTypes$i.exports.object,
17492
17492
  innerRef: propTypes$i.exports.oneOfType([propTypes$i.exports.object, propTypes$i.exports.string, propTypes$i.exports.func])
17493
17493
  });
17494
- var defaultProps$e = _objectSpread$5(_objectSpread$5({}, reactTransitionGroup.Transition.defaultProps), {}, {
17494
+ var defaultProps$e = _objectSpread$6(_objectSpread$6({}, reactTransitionGroup.Transition.defaultProps), {}, {
17495
17495
  tag: "div",
17496
17496
  baseClass: "fade",
17497
17497
  baseClassActive: "show",
@@ -17552,7 +17552,7 @@ Badge.propTypes = propTypes$d;
17552
17552
  Badge.defaultProps = defaultProps$d;
17553
17553
  const Badge$1 = Badge;
17554
17554
  var _excluded$9 = ["cssModule", "children", "isOpen", "flip", "target", "offset", "fallbackPlacement", "placementPrefix", "arrowClassName", "hideArrow", "popperClassName", "tag", "container", "modifiers", "positionFixed", "boundariesElement", "onClosed", "fade", "transition", "placement"];
17555
- function ownKeys$6(object2, enumerableOnly) {
17555
+ function ownKeys$7(object2, enumerableOnly) {
17556
17556
  var keys5 = Object.keys(object2);
17557
17557
  if (Object.getOwnPropertySymbols) {
17558
17558
  var symbols = Object.getOwnPropertySymbols(object2);
@@ -17565,17 +17565,17 @@ function ownKeys$6(object2, enumerableOnly) {
17565
17565
  }
17566
17566
  return keys5;
17567
17567
  }
17568
- function _objectSpread$4(target) {
17568
+ function _objectSpread$5(target) {
17569
17569
  for (var i2 = 1; i2 < arguments.length; i2++) {
17570
17570
  var source = arguments[i2] != null ? arguments[i2] : {};
17571
17571
  if (i2 % 2) {
17572
- ownKeys$6(Object(source), true).forEach(function(key2) {
17572
+ ownKeys$7(Object(source), true).forEach(function(key2) {
17573
17573
  _defineProperty(target, key2, source[key2]);
17574
17574
  });
17575
17575
  } else if (Object.getOwnPropertyDescriptors) {
17576
17576
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
17577
17577
  } else {
17578
- ownKeys$6(Object(source)).forEach(function(key2) {
17578
+ ownKeys$7(Object(source)).forEach(function(key2) {
17579
17579
  Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));
17580
17580
  });
17581
17581
  }
@@ -17618,7 +17618,7 @@ var defaultProps$c = {
17618
17618
  modifiers: {},
17619
17619
  onClosed: noop$3,
17620
17620
  fade: true,
17621
- transition: _objectSpread$4({}, Fade.defaultProps)
17621
+ transition: _objectSpread$5({}, Fade.defaultProps)
17622
17622
  };
17623
17623
  var PopperContent = /* @__PURE__ */ function(_React$Component) {
17624
17624
  _inheritsLoose$1(PopperContent2, _React$Component);
@@ -17676,7 +17676,7 @@ var PopperContent = /* @__PURE__ */ function(_React$Component) {
17676
17676
  var fade = _this$props.fade, transition = _this$props.transition, placement = _this$props.placement, attrs = _objectWithoutPropertiesLoose$1(_this$props, _excluded$9);
17677
17677
  var arrowClassName = mapToCssModules(classNames("arrow", _arrowClassName), cssModule);
17678
17678
  var popperClassName = mapToCssModules(classNames(_popperClassName, placementPrefix ? placementPrefix + "-auto" : ""), this.props.cssModule);
17679
- var extendedModifiers = _objectSpread$4({
17679
+ var extendedModifiers = _objectSpread$5({
17680
17680
  offset: {
17681
17681
  offset: offset2
17682
17682
  },
@@ -17688,7 +17688,7 @@ var PopperContent = /* @__PURE__ */ function(_React$Component) {
17688
17688
  boundariesElement
17689
17689
  }
17690
17690
  }, modifiers2);
17691
- var popperTransition = _objectSpread$4(_objectSpread$4(_objectSpread$4({}, Fade.defaultProps), transition), {}, {
17691
+ var popperTransition = _objectSpread$5(_objectSpread$5(_objectSpread$5({}, Fade.defaultProps), transition), {}, {
17692
17692
  baseClass: fade ? transition.baseClass : "",
17693
17693
  timeout: fade ? transition.timeout : 0
17694
17694
  });
@@ -18088,7 +18088,7 @@ var Portal = /* @__PURE__ */ function(_React$Component) {
18088
18088
  }(React$1.Component);
18089
18089
  Portal.propTypes = propTypes$a;
18090
18090
  const Portal$1 = Portal;
18091
- function ownKeys$5(object2, enumerableOnly) {
18091
+ function ownKeys$6(object2, enumerableOnly) {
18092
18092
  var keys5 = Object.keys(object2);
18093
18093
  if (Object.getOwnPropertySymbols) {
18094
18094
  var symbols = Object.getOwnPropertySymbols(object2);
@@ -18101,17 +18101,17 @@ function ownKeys$5(object2, enumerableOnly) {
18101
18101
  }
18102
18102
  return keys5;
18103
18103
  }
18104
- function _objectSpread$3(target) {
18104
+ function _objectSpread$4(target) {
18105
18105
  for (var i2 = 1; i2 < arguments.length; i2++) {
18106
18106
  var source = arguments[i2] != null ? arguments[i2] : {};
18107
18107
  if (i2 % 2) {
18108
- ownKeys$5(Object(source), true).forEach(function(key2) {
18108
+ ownKeys$6(Object(source), true).forEach(function(key2) {
18109
18109
  _defineProperty(target, key2, source[key2]);
18110
18110
  });
18111
18111
  } else if (Object.getOwnPropertyDescriptors) {
18112
18112
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
18113
18113
  } else {
18114
- ownKeys$5(Object(source)).forEach(function(key2) {
18114
+ ownKeys$6(Object(source)).forEach(function(key2) {
18115
18115
  Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));
18116
18116
  });
18117
18117
  }
@@ -18457,11 +18457,11 @@ var Modal = /* @__PURE__ */ function(_React$Component) {
18457
18457
  tabIndex: "-1"
18458
18458
  };
18459
18459
  var hasTransition = this.props.fade;
18460
- var modalTransition = _objectSpread$3(_objectSpread$3(_objectSpread$3({}, Fade.defaultProps), this.props.modalTransition), {}, {
18460
+ var modalTransition = _objectSpread$4(_objectSpread$4(_objectSpread$4({}, Fade.defaultProps), this.props.modalTransition), {}, {
18461
18461
  baseClass: hasTransition ? this.props.modalTransition.baseClass : "",
18462
18462
  timeout: hasTransition ? this.props.modalTransition.timeout : 0
18463
18463
  });
18464
- var backdropTransition = _objectSpread$3(_objectSpread$3(_objectSpread$3({}, Fade.defaultProps), this.props.backdropTransition), {}, {
18464
+ var backdropTransition = _objectSpread$4(_objectSpread$4(_objectSpread$4({}, Fade.defaultProps), this.props.backdropTransition), {}, {
18465
18465
  baseClass: hasTransition ? this.props.backdropTransition.baseClass : "",
18466
18466
  timeout: hasTransition ? this.props.backdropTransition.timeout : 0
18467
18467
  });
@@ -18820,7 +18820,7 @@ Label.propTypes = propTypes$2;
18820
18820
  Label.defaultProps = defaultProps$2;
18821
18821
  const Label$1 = Label;
18822
18822
  var _excluded$1 = ["className", "closeClassName", "closeAriaLabel", "cssModule", "tag", "color", "isOpen", "toggle", "children", "transition", "fade", "innerRef"];
18823
- function ownKeys$4(object2, enumerableOnly) {
18823
+ function ownKeys$5(object2, enumerableOnly) {
18824
18824
  var keys5 = Object.keys(object2);
18825
18825
  if (Object.getOwnPropertySymbols) {
18826
18826
  var symbols = Object.getOwnPropertySymbols(object2);
@@ -18833,17 +18833,17 @@ function ownKeys$4(object2, enumerableOnly) {
18833
18833
  }
18834
18834
  return keys5;
18835
18835
  }
18836
- function _objectSpread$2(target) {
18836
+ function _objectSpread$3(target) {
18837
18837
  for (var i2 = 1; i2 < arguments.length; i2++) {
18838
18838
  var source = arguments[i2] != null ? arguments[i2] : {};
18839
18839
  if (i2 % 2) {
18840
- ownKeys$4(Object(source), true).forEach(function(key2) {
18840
+ ownKeys$5(Object(source), true).forEach(function(key2) {
18841
18841
  _defineProperty(target, key2, source[key2]);
18842
18842
  });
18843
18843
  } else if (Object.getOwnPropertyDescriptors) {
18844
18844
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
18845
18845
  } else {
18846
- ownKeys$4(Object(source)).forEach(function(key2) {
18846
+ ownKeys$5(Object(source)).forEach(function(key2) {
18847
18847
  Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));
18848
18848
  });
18849
18849
  }
@@ -18870,7 +18870,7 @@ var defaultProps$1 = {
18870
18870
  tag: "div",
18871
18871
  closeAriaLabel: "Close",
18872
18872
  fade: true,
18873
- transition: _objectSpread$2(_objectSpread$2({}, Fade.defaultProps), {}, {
18873
+ transition: _objectSpread$3(_objectSpread$3({}, Fade.defaultProps), {}, {
18874
18874
  unmountOnExit: true
18875
18875
  })
18876
18876
  };
@@ -18880,7 +18880,7 @@ function Alert(props) {
18880
18880
  "alert-dismissible": toggle2
18881
18881
  }), cssModule);
18882
18882
  var closeClasses = mapToCssModules(classNames("close", closeClassName), cssModule);
18883
- var alertTransition = _objectSpread$2(_objectSpread$2(_objectSpread$2({}, Fade.defaultProps), transition), {}, {
18883
+ var alertTransition = _objectSpread$3(_objectSpread$3(_objectSpread$3({}, Fade.defaultProps), transition), {}, {
18884
18884
  baseClass: fade ? transition.baseClass : "",
18885
18885
  timeout: fade ? transition.timeout : 0
18886
18886
  });
@@ -18906,6 +18906,66 @@ function Alert(props) {
18906
18906
  }
18907
18907
  Alert.propTypes = propTypes$1;
18908
18908
  Alert.defaultProps = defaultProps$1;
18909
+ function ownKeys$4(object2, enumerableOnly) {
18910
+ var keys5 = Object.keys(object2);
18911
+ if (Object.getOwnPropertySymbols) {
18912
+ var symbols = Object.getOwnPropertySymbols(object2);
18913
+ if (enumerableOnly) {
18914
+ symbols = symbols.filter(function(sym) {
18915
+ return Object.getOwnPropertyDescriptor(object2, sym).enumerable;
18916
+ });
18917
+ }
18918
+ keys5.push.apply(keys5, symbols);
18919
+ }
18920
+ return keys5;
18921
+ }
18922
+ function _objectSpread$2(target) {
18923
+ for (var i2 = 1; i2 < arguments.length; i2++) {
18924
+ var source = arguments[i2] != null ? arguments[i2] : {};
18925
+ if (i2 % 2) {
18926
+ ownKeys$4(Object(source), true).forEach(function(key2) {
18927
+ _defineProperty(target, key2, source[key2]);
18928
+ });
18929
+ } else if (Object.getOwnPropertyDescriptors) {
18930
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
18931
+ } else {
18932
+ ownKeys$4(Object(source)).forEach(function(key2) {
18933
+ Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));
18934
+ });
18935
+ }
18936
+ }
18937
+ return target;
18938
+ }
18939
+ var omitKeys = ["defaultOpen"];
18940
+ var UncontrolledTooltip = /* @__PURE__ */ function(_Component) {
18941
+ _inheritsLoose$1(UncontrolledTooltip2, _Component);
18942
+ function UncontrolledTooltip2(props) {
18943
+ var _this;
18944
+ _this = _Component.call(this, props) || this;
18945
+ _this.state = {
18946
+ isOpen: props.defaultOpen || false
18947
+ };
18948
+ _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
18949
+ return _this;
18950
+ }
18951
+ var _proto = UncontrolledTooltip2.prototype;
18952
+ _proto.toggle = function toggle2() {
18953
+ this.setState({
18954
+ isOpen: !this.state.isOpen
18955
+ });
18956
+ };
18957
+ _proto.render = function render() {
18958
+ return /* @__PURE__ */ jsx(Tooltip$1, {
18959
+ isOpen: this.state.isOpen,
18960
+ toggle: this.toggle,
18961
+ ...omit(this.props, omitKeys)
18962
+ });
18963
+ };
18964
+ return UncontrolledTooltip2;
18965
+ }(react.exports.Component);
18966
+ UncontrolledTooltip.propTypes = _objectSpread$2({
18967
+ defaultOpen: propTypes$i.exports.bool
18968
+ }, Tooltip$1.propTypes);
18909
18969
  var _excluded = ["className", "cssModule", "type", "size", "color", "children", "tag"];
18910
18970
  var propTypes = {
18911
18971
  tag: tagPropType,
@@ -31703,16 +31763,14 @@ function WidgetInitForm({
31703
31763
  longitude,
31704
31764
  latitude,
31705
31765
  location: location2,
31706
- country_code,
31707
- continent
31766
+ country_code
31708
31767
  }, setState] = useState({
31709
31768
  ipAddress: void 0,
31710
31769
  country: "",
31711
31770
  longitude: void 0,
31712
31771
  latitude: void 0,
31713
31772
  location: "",
31714
- country_code: "",
31715
- continent: ""
31773
+ country_code: ""
31716
31774
  });
31717
31775
  const [mobile, setMobile] = useState("");
31718
31776
  const validSchema = react.exports.useMemo(() => {
@@ -31727,8 +31785,7 @@ function WidgetInitForm({
31727
31785
  };
31728
31786
  const fieldKeys = ["account", "bvn"];
31729
31787
  fieldKeys.map((key2) => {
31730
- var _a;
31731
- if ((_a = fields == null ? void 0 : fields[key2]) == null ? void 0 : _a.show) {
31788
+ if (fields[key2].show) {
31732
31789
  shape[key2] = possibleShape[key2];
31733
31790
  }
31734
31791
  });
@@ -31742,18 +31799,15 @@ function WidgetInitForm({
31742
31799
  country_name,
31743
31800
  longitude: longitude2,
31744
31801
  latitude: latitude2,
31745
- country_code: country_code2,
31746
- timezone: timezone2
31802
+ country_code: country_code2
31747
31803
  } = data2.data;
31748
- const timezoneStringSplit = timezone2.split("/");
31749
31804
  setState({
31750
31805
  ipAddress: ip,
31751
31806
  country: country_name,
31752
31807
  longitude: longitude2,
31753
31808
  latitude: latitude2,
31754
31809
  location: region,
31755
- country_code: country_code2,
31756
- continent: timezoneStringSplit[0]
31810
+ country_code: country_code2
31757
31811
  });
31758
31812
  const requestObject = {
31759
31813
  ip_address: ip,
@@ -31794,8 +31848,7 @@ function WidgetInitForm({
31794
31848
  latitude,
31795
31849
  longitude,
31796
31850
  location: location2,
31797
- source_url,
31798
- continent
31851
+ source_url
31799
31852
  }, "post"), {
31800
31853
  onError: (err) => {
31801
31854
  toast.error("Error occured, try again", {
@@ -31807,7 +31860,6 @@ function WidgetInitForm({
31807
31860
  ...data2
31808
31861
  }) => {
31809
31862
  if (status) {
31810
- console.log("customer", data2);
31811
31863
  dataRef.current = data2;
31812
31864
  setParentState({
31813
31865
  chatInit: true
@@ -31884,7 +31936,7 @@ function WidgetInitForm({
31884
31936
  children: formik.errors.email
31885
31937
  })]
31886
31938
  }), Object.keys(fields || {}).map((key2) => {
31887
- if (fields[key2].show === true || fields[key2].show === void 0) {
31939
+ if (fields[key2].show === true) {
31888
31940
  if (key2 === "mobile") {
31889
31941
  return /* @__PURE__ */ jsxs(FormGroup$1, {
31890
31942
  children: [/* @__PURE__ */ jsx(Label$1, {
@@ -41656,15 +41708,6 @@ const SvgEllipse = (props) => /* @__PURE__ */ react.exports.createElement("svg",
41656
41708
  }), /* @__PURE__ */ react.exports.createElement("path", {
41657
41709
  d: "M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"
41658
41710
  }));
41659
- const SvgBackArrow = (props) => /* @__PURE__ */ react.exports.createElement("svg", {
41660
- id: "Layer_1",
41661
- "data-name": "Layer 1",
41662
- xmlns: "http://www.w3.org/2000/svg",
41663
- viewBox: "0 0 122.88 108.06",
41664
- ...props
41665
- }, /* @__PURE__ */ react.exports.createElement("title", null, "back-arrow"), /* @__PURE__ */ react.exports.createElement("path", {
41666
- d: "M63.94,24.28a14.28,14.28,0,0,0-20.36-20L4.1,44.42a14.27,14.27,0,0,0,0,20l38.69,39.35a14.27,14.27,0,0,0,20.35-20L48.06,68.41l60.66-.29a14.27,14.27,0,1,0-.23-28.54l-59.85.28,15.3-15.58Z"
41667
- }));
41668
41711
  const calendars = (params) => api("/calendars", params);
41669
41712
  const viewCalendar = (id2, params) => api("/calendars/" + id2, params);
41670
41713
  const updateCalendar = (id2, params) => api("/calendars/" + id2, params, "put");
@@ -42275,14 +42318,8 @@ const Done = react.exports.memo(({
42275
42318
  style: {
42276
42319
  color: `${hexcode}`
42277
42320
  },
42278
- children: [/* @__PURE__ */ jsx(SvgBackArrow, {
42279
- role: "button",
42280
- width: 20,
42281
- height: 20,
42282
- className: "m-2 align-self-start",
42283
- onClick: done
42284
- }), /* @__PURE__ */ jsx(SvgCheckedCircle, {
42285
- className: "mb-4"
42321
+ children: [/* @__PURE__ */ jsx(SvgCheckedCircle, {
42322
+ className: "my-4"
42286
42323
  }), /* @__PURE__ */ jsx("h1", {
42287
42324
  className: "text-alt font-weight-bold",
42288
42325
  children: "Thank You"
@@ -42311,6 +42348,10 @@ const Done = react.exports.memo(({
42311
42348
  target: "_blank",
42312
42349
  rel: "noopener noreferrer",
42313
42350
  children: "Add to calendar"
42351
+ }), /* @__PURE__ */ jsx("button", {
42352
+ className: "btn m-2 btn-outline-secondary",
42353
+ onClick: done,
42354
+ children: "Back"
42314
42355
  })]
42315
42356
  });
42316
42357
  });
@@ -45788,7 +45829,6 @@ var Rating = dist.Rating = function(t2) {
45788
45829
  const createFeedback = (params) => api("feedbacks", params, "post");
45789
45830
  const getWaitConnectors = async (data2) => api("wait-connectors", data2);
45790
45831
  const getLongestWaitTime = async (data2) => api("waits/longest", data2);
45791
- const updateWait = async (id2, data2) => api(`waits/${id2}`, data2, "put");
45792
45832
  function Feedback({
45793
45833
  agent: agent_,
45794
45834
  quickStopChat,
@@ -47168,7 +47208,6 @@ function UnwrapWidget({
47168
47208
  }
47169
47209
  }, [companyUser]);
47170
47210
  const [isWidgetLaunched, setIsWidgetLaunched] = useState(false);
47171
- const [showTip, setShowTip] = useState(false);
47172
47211
  const company_id = projectId || config.projectId;
47173
47212
  const {
47174
47213
  state: {
@@ -47196,21 +47235,14 @@ function UnwrapWidget({
47196
47235
  }
47197
47236
  }, [isLoadingCompany, company == null ? void 0 : company.name]);
47198
47237
  react.exports.useEffect(() => {
47199
- if (!isLoadingCompany) {
47200
- const timeout = setTimeout(() => setShowTip(true), 100);
47201
- const timeout1 = setTimeout(() => setShowTip(false), 30 * 1e3);
47202
- return () => {
47203
- clearTimeout(timeout);
47204
- clearTimeout(timeout1);
47205
- };
47238
+ const element = document.getElementById("welcomeMessage");
47239
+ if (element) {
47240
+ element.click();
47206
47241
  }
47207
- }, [isLoadingCompany]);
47208
- if (isLoadingCompany || isLoadingCompany === void 0) {
47209
- return null;
47210
- }
47242
+ }, [document.getElementById("welcomeMessage")]);
47211
47243
  return /* @__PURE__ */ jsxs("div", {
47212
47244
  className: `widget-cover mb-2 ${isWidgetLaunched ? "widget-cover-container" : ""}`,
47213
- children: [/* @__PURE__ */ jsx(WidgetFormDisplay, {
47245
+ children: [isLoadingCompany || isLoadingCompany === void 0 ? /* @__PURE__ */ jsx(Spinner$2, {}) : /* @__PURE__ */ jsx(WidgetFormDisplay, {
47214
47246
  companyIsClosed,
47215
47247
  company_id,
47216
47248
  company,
@@ -47218,9 +47250,9 @@ function UnwrapWidget({
47218
47250
  setIsWidgetLaunched,
47219
47251
  isWidgetLaunched
47220
47252
  }), /* @__PURE__ */ jsxs("div", {
47221
- children: [/* @__PURE__ */ jsx(Tooltip$1, {
47253
+ children: [/* @__PURE__ */ jsx(UncontrolledTooltip, {
47222
47254
  placement: "right",
47223
- isOpen: showTip,
47255
+ trigger: "click",
47224
47256
  target: "welcomeMessage",
47225
47257
  style: {
47226
47258
  backgroundColor: `${hex_code}`
@@ -47229,10 +47261,7 @@ function UnwrapWidget({
47229
47261
  }), /* @__PURE__ */ jsx("div", {
47230
47262
  id: "welcomeMessage",
47231
47263
  className: `widget-launcher-container mx-5 mb-5 mt-2 ${isWidgetLaunched ? "" : "animate"}`,
47232
- onClick: () => {
47233
- setShowTip(false);
47234
- setIsWidgetLaunched(!isWidgetLaunched);
47235
- },
47264
+ onClick: () => setIsWidgetLaunched(!isWidgetLaunched),
47236
47265
  style: {
47237
47266
  backgroundColor: `${hex_code}`
47238
47267
  },
@@ -47286,7 +47315,7 @@ const WidgetFormDisplay = react.exports.memo(({
47286
47315
  setIsWidgetLaunched,
47287
47316
  isWidgetLaunched
47288
47317
  }) => {
47289
- var _a, _b, _c, _d;
47318
+ var _a, _b, _c, _d, _e, _f;
47290
47319
  const {
47291
47320
  socket: socket2
47292
47321
  } = useSocket();
@@ -47333,18 +47362,26 @@ const WidgetFormDisplay = react.exports.memo(({
47333
47362
  }
47334
47363
  }, [socket2.connected, chatInit, customer == null ? void 0 : customer.id]);
47335
47364
  const quickStopChat = react.exports.useCallback(() => {
47365
+ var _a2, _b2, _c2, _d2;
47336
47366
  setState({
47337
47367
  chatInit: false,
47338
47368
  chatClose: true,
47339
47369
  companyClosed: companyIsClosed
47340
47370
  });
47371
+ ((_a2 = dataRef.current) == null ? void 0 : _a2.wait) && socket2.emit("chat.ended", {
47372
+ to: (_b2 = agent == null ? void 0 : agent.user) == null ? void 0 : _b2.id,
47373
+ waitId: (_d2 = (_c2 = dataRef.current) == null ? void 0 : _c2.wait) == null ? void 0 : _d2.id,
47374
+ customer
47375
+ });
47341
47376
  dataRef.current = null;
47342
- }, [companyIsClosed, dataRef]);
47377
+ }, [companyIsClosed, (_b = dataRef.current) == null ? void 0 : _b.wait, (_c = agent == null ? void 0 : agent.user) == null ? void 0 : _c.id, customer]);
47343
47378
  const setChatClose = (chatClose2) => {
47344
- var _a2, _b2;
47379
+ var _a2, _b2, _c2;
47345
47380
  t$1.emit("chat-ended");
47346
- updateWait((_b2 = (_a2 = dataRef.current) == null ? void 0 : _a2.wait) == null ? void 0 : _b2.id, {
47347
- status: "ended"
47381
+ socket2.emit("chat.ended", {
47382
+ to: (_a2 = agent == null ? void 0 : agent.user) == null ? void 0 : _a2.id,
47383
+ waitId: (_c2 = (_b2 = dataRef.current) == null ? void 0 : _b2.wait) == null ? void 0 : _c2.id,
47384
+ customer
47348
47385
  });
47349
47386
  setState({
47350
47387
  chatClose: chatClose2
@@ -47399,7 +47436,7 @@ const WidgetFormDisplay = react.exports.memo(({
47399
47436
  quickStopChat,
47400
47437
  company,
47401
47438
  videoRef
47402
- }), !!((_c = (_b = dataRef == null ? void 0 : dataRef.current) == null ? void 0 : _b.wait) == null ? void 0 : _c.createdAt) && !stateRef.current.agent && /* @__PURE__ */ jsx(LongestWaitime, {}), /* @__PURE__ */ jsx("div", {
47439
+ }), !!((_e = (_d = dataRef == null ? void 0 : dataRef.current) == null ? void 0 : _d.wait) == null ? void 0 : _e.createdAt) && !stateRef.current.agent && /* @__PURE__ */ jsx(LongestWaitime, {}), /* @__PURE__ */ jsx("div", {
47403
47440
  className: `widget-body-container px-3 ${companyClosed && "widget-body-container-offline"} `,
47404
47441
  children: isLoadingCustomer ? /* @__PURE__ */ jsx(Spinner$2, {}) : isScheduling ? /* @__PURE__ */ jsx(Schedules, {
47405
47442
  setParentState: setState,
@@ -47421,7 +47458,7 @@ const WidgetFormDisplay = react.exports.memo(({
47421
47458
  }) : chatInit && !chatClose ? /* @__PURE__ */ jsx(Feedback$1, {
47422
47459
  quickStopChat,
47423
47460
  agent,
47424
- conversation_id: (_d = dataRef.current) == null ? void 0 : _d.wait.conversation.id
47461
+ conversation_id: (_f = dataRef.current) == null ? void 0 : _f.wait.conversation.id
47425
47462
  }) : !chatInit ? /* @__PURE__ */ jsx(WidgetInitForm$1, {
47426
47463
  company_id,
47427
47464
  companyUser,