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

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, omitKeys2) {
6250
+ function omit(obj, omitKeys) {
6251
6251
  var result = {};
6252
6252
  Object.keys(obj).forEach(function(key2) {
6253
- if (omitKeys2.indexOf(key2) === -1) {
6253
+ if (omitKeys.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$8(object2, enumerableOnly) {
17455
+ function ownKeys$7(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$8(object2, enumerableOnly) {
17465
17465
  }
17466
17466
  return keys5;
17467
17467
  }
17468
- function _objectSpread$6(target) {
17468
+ function _objectSpread$5(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$8(Object(source), true).forEach(function(key2) {
17472
+ ownKeys$7(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$8(Object(source)).forEach(function(key2) {
17478
+ ownKeys$7(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$6(_objectSpread$6({}, reactTransitionGroup.Transition.propTypes), {}, {
17485
+ var propTypes$e = _objectSpread$5(_objectSpread$5({}, 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$6(_objectSpread$6({}, 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$6(_objectSpread$6({}, reactTransitionGroup.Transition.defaultProps), {}, {
17494
+ var defaultProps$e = _objectSpread$5(_objectSpread$5({}, 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$7(object2, enumerableOnly) {
17555
+ function ownKeys$6(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$7(object2, enumerableOnly) {
17565
17565
  }
17566
17566
  return keys5;
17567
17567
  }
17568
- function _objectSpread$5(target) {
17568
+ function _objectSpread$4(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$7(Object(source), true).forEach(function(key2) {
17572
+ ownKeys$6(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$7(Object(source)).forEach(function(key2) {
17578
+ ownKeys$6(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$5({}, Fade.defaultProps)
17621
+ transition: _objectSpread$4({}, 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$5({
17679
+ var extendedModifiers = _objectSpread$4({
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$5(_objectSpread$5(_objectSpread$5({}, Fade.defaultProps), transition), {}, {
17691
+ var popperTransition = _objectSpread$4(_objectSpread$4(_objectSpread$4({}, 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$6(object2, enumerableOnly) {
18091
+ function ownKeys$5(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$6(object2, enumerableOnly) {
18101
18101
  }
18102
18102
  return keys5;
18103
18103
  }
18104
- function _objectSpread$4(target) {
18104
+ function _objectSpread$3(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$6(Object(source), true).forEach(function(key2) {
18108
+ ownKeys$5(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$6(Object(source)).forEach(function(key2) {
18114
+ ownKeys$5(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$4(_objectSpread$4(_objectSpread$4({}, Fade.defaultProps), this.props.modalTransition), {}, {
18460
+ var modalTransition = _objectSpread$3(_objectSpread$3(_objectSpread$3({}, 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$4(_objectSpread$4(_objectSpread$4({}, Fade.defaultProps), this.props.backdropTransition), {}, {
18464
+ var backdropTransition = _objectSpread$3(_objectSpread$3(_objectSpread$3({}, 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$5(object2, enumerableOnly) {
18823
+ function ownKeys$4(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$5(object2, enumerableOnly) {
18833
18833
  }
18834
18834
  return keys5;
18835
18835
  }
18836
- function _objectSpread$3(target) {
18836
+ function _objectSpread$2(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$5(Object(source), true).forEach(function(key2) {
18840
+ ownKeys$4(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$5(Object(source)).forEach(function(key2) {
18846
+ ownKeys$4(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$3(_objectSpread$3({}, Fade.defaultProps), {}, {
18873
+ transition: _objectSpread$2(_objectSpread$2({}, 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$3(_objectSpread$3(_objectSpread$3({}, Fade.defaultProps), transition), {}, {
18883
+ var alertTransition = _objectSpread$2(_objectSpread$2(_objectSpread$2({}, Fade.defaultProps), transition), {}, {
18884
18884
  baseClass: fade ? transition.baseClass : "",
18885
18885
  timeout: fade ? transition.timeout : 0
18886
18886
  });
@@ -18906,66 +18906,6 @@ 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);
18969
18909
  var _excluded = ["className", "cssModule", "type", "size", "color", "children", "tag"];
18970
18910
  var propTypes = {
18971
18911
  tag: tagPropType,
@@ -31763,14 +31703,16 @@ function WidgetInitForm({
31763
31703
  longitude,
31764
31704
  latitude,
31765
31705
  location: location2,
31766
- country_code
31706
+ country_code,
31707
+ continent
31767
31708
  }, setState] = useState({
31768
31709
  ipAddress: void 0,
31769
31710
  country: "",
31770
31711
  longitude: void 0,
31771
31712
  latitude: void 0,
31772
31713
  location: "",
31773
- country_code: ""
31714
+ country_code: "",
31715
+ continent: ""
31774
31716
  });
31775
31717
  const [mobile, setMobile] = useState("");
31776
31718
  const validSchema = react.exports.useMemo(() => {
@@ -31785,7 +31727,8 @@ function WidgetInitForm({
31785
31727
  };
31786
31728
  const fieldKeys = ["account", "bvn"];
31787
31729
  fieldKeys.map((key2) => {
31788
- if (fields[key2].show) {
31730
+ var _a;
31731
+ if ((_a = fields == null ? void 0 : fields[key2]) == null ? void 0 : _a.show) {
31789
31732
  shape[key2] = possibleShape[key2];
31790
31733
  }
31791
31734
  });
@@ -31799,15 +31742,18 @@ function WidgetInitForm({
31799
31742
  country_name,
31800
31743
  longitude: longitude2,
31801
31744
  latitude: latitude2,
31802
- country_code: country_code2
31745
+ country_code: country_code2,
31746
+ timezone: timezone2
31803
31747
  } = data2.data;
31748
+ const timezoneStringSplit = timezone2.split("/");
31804
31749
  setState({
31805
31750
  ipAddress: ip,
31806
31751
  country: country_name,
31807
31752
  longitude: longitude2,
31808
31753
  latitude: latitude2,
31809
31754
  location: region,
31810
- country_code: country_code2
31755
+ country_code: country_code2,
31756
+ continent: timezoneStringSplit[0]
31811
31757
  });
31812
31758
  const requestObject = {
31813
31759
  ip_address: ip,
@@ -31848,7 +31794,8 @@ function WidgetInitForm({
31848
31794
  latitude,
31849
31795
  longitude,
31850
31796
  location: location2,
31851
- source_url
31797
+ source_url,
31798
+ continent
31852
31799
  }, "post"), {
31853
31800
  onError: (err) => {
31854
31801
  toast.error("Error occured, try again", {
@@ -31860,6 +31807,7 @@ function WidgetInitForm({
31860
31807
  ...data2
31861
31808
  }) => {
31862
31809
  if (status) {
31810
+ console.log("customer", data2);
31863
31811
  dataRef.current = data2;
31864
31812
  setParentState({
31865
31813
  chatInit: true
@@ -31936,7 +31884,7 @@ function WidgetInitForm({
31936
31884
  children: formik.errors.email
31937
31885
  })]
31938
31886
  }), Object.keys(fields || {}).map((key2) => {
31939
- if (fields[key2].show === true) {
31887
+ if (fields[key2].show === true || fields[key2].show === void 0) {
31940
31888
  if (key2 === "mobile") {
31941
31889
  return /* @__PURE__ */ jsxs(FormGroup$1, {
31942
31890
  children: [/* @__PURE__ */ jsx(Label$1, {
@@ -41708,6 +41656,15 @@ const SvgEllipse = (props) => /* @__PURE__ */ react.exports.createElement("svg",
41708
41656
  }), /* @__PURE__ */ react.exports.createElement("path", {
41709
41657
  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"
41710
41658
  }));
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
+ }));
41711
41668
  const calendars = (params) => api("/calendars", params);
41712
41669
  const viewCalendar = (id2, params) => api("/calendars/" + id2, params);
41713
41670
  const updateCalendar = (id2, params) => api("/calendars/" + id2, params, "put");
@@ -42318,8 +42275,14 @@ const Done = react.exports.memo(({
42318
42275
  style: {
42319
42276
  color: `${hexcode}`
42320
42277
  },
42321
- children: [/* @__PURE__ */ jsx(SvgCheckedCircle, {
42322
- className: "my-4"
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"
42323
42286
  }), /* @__PURE__ */ jsx("h1", {
42324
42287
  className: "text-alt font-weight-bold",
42325
42288
  children: "Thank You"
@@ -42348,10 +42311,6 @@ const Done = react.exports.memo(({
42348
42311
  target: "_blank",
42349
42312
  rel: "noopener noreferrer",
42350
42313
  children: "Add to calendar"
42351
- }), /* @__PURE__ */ jsx("button", {
42352
- className: "btn m-2 btn-outline-secondary",
42353
- onClick: done,
42354
- children: "Back"
42355
42314
  })]
42356
42315
  });
42357
42316
  });
@@ -45829,6 +45788,7 @@ var Rating = dist.Rating = function(t2) {
45829
45788
  const createFeedback = (params) => api("feedbacks", params, "post");
45830
45789
  const getWaitConnectors = async (data2) => api("wait-connectors", data2);
45831
45790
  const getLongestWaitTime = async (data2) => api("waits/longest", data2);
45791
+ const updateWait = async (id2, data2) => api(`waits/${id2}`, data2, "put");
45832
45792
  function Feedback({
45833
45793
  agent: agent_,
45834
45794
  quickStopChat,
@@ -47208,6 +47168,7 @@ function UnwrapWidget({
47208
47168
  }
47209
47169
  }, [companyUser]);
47210
47170
  const [isWidgetLaunched, setIsWidgetLaunched] = useState(false);
47171
+ const [showTip, setShowTip] = useState(false);
47211
47172
  const company_id = projectId || config.projectId;
47212
47173
  const {
47213
47174
  state: {
@@ -47235,14 +47196,21 @@ function UnwrapWidget({
47235
47196
  }
47236
47197
  }, [isLoadingCompany, company == null ? void 0 : company.name]);
47237
47198
  react.exports.useEffect(() => {
47238
- const element = document.getElementById("welcomeMessage");
47239
- if (element) {
47240
- element.click();
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
+ };
47241
47206
  }
47242
- }, [document.getElementById("welcomeMessage")]);
47207
+ }, [isLoadingCompany]);
47208
+ if (isLoadingCompany || isLoadingCompany === void 0) {
47209
+ return null;
47210
+ }
47243
47211
  return /* @__PURE__ */ jsxs("div", {
47244
47212
  className: `widget-cover mb-2 ${isWidgetLaunched ? "widget-cover-container" : ""}`,
47245
- children: [isLoadingCompany || isLoadingCompany === void 0 ? /* @__PURE__ */ jsx(Spinner$2, {}) : /* @__PURE__ */ jsx(WidgetFormDisplay, {
47213
+ children: [/* @__PURE__ */ jsx(WidgetFormDisplay, {
47246
47214
  companyIsClosed,
47247
47215
  company_id,
47248
47216
  company,
@@ -47250,9 +47218,9 @@ function UnwrapWidget({
47250
47218
  setIsWidgetLaunched,
47251
47219
  isWidgetLaunched
47252
47220
  }), /* @__PURE__ */ jsxs("div", {
47253
- children: [/* @__PURE__ */ jsx(UncontrolledTooltip, {
47221
+ children: [/* @__PURE__ */ jsx(Tooltip$1, {
47254
47222
  placement: "right",
47255
- trigger: "click",
47223
+ isOpen: showTip,
47256
47224
  target: "welcomeMessage",
47257
47225
  style: {
47258
47226
  backgroundColor: `${hex_code}`
@@ -47261,7 +47229,10 @@ function UnwrapWidget({
47261
47229
  }), /* @__PURE__ */ jsx("div", {
47262
47230
  id: "welcomeMessage",
47263
47231
  className: `widget-launcher-container mx-5 mb-5 mt-2 ${isWidgetLaunched ? "" : "animate"}`,
47264
- onClick: () => setIsWidgetLaunched(!isWidgetLaunched),
47232
+ onClick: () => {
47233
+ setShowTip(false);
47234
+ setIsWidgetLaunched(!isWidgetLaunched);
47235
+ },
47265
47236
  style: {
47266
47237
  backgroundColor: `${hex_code}`
47267
47238
  },
@@ -47315,7 +47286,7 @@ const WidgetFormDisplay = react.exports.memo(({
47315
47286
  setIsWidgetLaunched,
47316
47287
  isWidgetLaunched
47317
47288
  }) => {
47318
- var _a, _b, _c, _d, _e, _f;
47289
+ var _a, _b, _c, _d;
47319
47290
  const {
47320
47291
  socket: socket2
47321
47292
  } = useSocket();
@@ -47362,26 +47333,18 @@ const WidgetFormDisplay = react.exports.memo(({
47362
47333
  }
47363
47334
  }, [socket2.connected, chatInit, customer == null ? void 0 : customer.id]);
47364
47335
  const quickStopChat = react.exports.useCallback(() => {
47365
- var _a2, _b2, _c2, _d2;
47366
47336
  setState({
47367
47337
  chatInit: false,
47368
47338
  chatClose: true,
47369
47339
  companyClosed: companyIsClosed
47370
47340
  });
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
- });
47376
47341
  dataRef.current = null;
47377
- }, [companyIsClosed, (_b = dataRef.current) == null ? void 0 : _b.wait, (_c = agent == null ? void 0 : agent.user) == null ? void 0 : _c.id, customer]);
47342
+ }, [companyIsClosed, dataRef]);
47378
47343
  const setChatClose = (chatClose2) => {
47379
- var _a2, _b2, _c2;
47344
+ var _a2, _b2;
47380
47345
  t$1.emit("chat-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
47346
+ updateWait((_b2 = (_a2 = dataRef.current) == null ? void 0 : _a2.wait) == null ? void 0 : _b2.id, {
47347
+ status: "ended"
47385
47348
  });
47386
47349
  setState({
47387
47350
  chatClose: chatClose2
@@ -47436,7 +47399,7 @@ const WidgetFormDisplay = react.exports.memo(({
47436
47399
  quickStopChat,
47437
47400
  company,
47438
47401
  videoRef
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", {
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", {
47440
47403
  className: `widget-body-container px-3 ${companyClosed && "widget-body-container-offline"} `,
47441
47404
  children: isLoadingCustomer ? /* @__PURE__ */ jsx(Spinner$2, {}) : isScheduling ? /* @__PURE__ */ jsx(Schedules, {
47442
47405
  setParentState: setState,
@@ -47458,7 +47421,7 @@ const WidgetFormDisplay = react.exports.memo(({
47458
47421
  }) : chatInit && !chatClose ? /* @__PURE__ */ jsx(Feedback$1, {
47459
47422
  quickStopChat,
47460
47423
  agent,
47461
- conversation_id: (_f = dataRef.current) == null ? void 0 : _f.wait.conversation.id
47424
+ conversation_id: (_d = dataRef.current) == null ? void 0 : _d.wait.conversation.id
47462
47425
  }) : !chatInit ? /* @__PURE__ */ jsx(WidgetInitForm$1, {
47463
47426
  company_id,
47464
47427
  companyUser,