@aslaluroba/help-center-react 3.2.13 → 3.2.15

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
@@ -31109,7 +31109,7 @@ var AgentResponse = _ref => {
31109
31109
  onType
31110
31110
  } = _ref;
31111
31111
  // Ensure messageContent is always a string to prevent errors
31112
- var safeMessageContent = messageContent !== null && messageContent !== void 0 ? messageContent : '';
31112
+ var safeMessageContent = messageContent !== null && messageContent !== void 0 ? messageContent : "";
31113
31113
  var shouldAnimate = (senderType === 2 || senderType === 3) && !seenMessagesRef.has(messageId);
31114
31114
  var animatedText = useTypewriter(safeMessageContent, 20, onType);
31115
31115
  var finalMessage = shouldAnimate ? animatedText : safeMessageContent;
@@ -31118,7 +31118,7 @@ var AgentResponse = _ref => {
31118
31118
  seenMessagesRef.add(messageId);
31119
31119
  }
31120
31120
  return jsxRuntime.jsx("div", {
31121
- className: "babylai:rounded-2xl babylai:p-4 ".concat(senderType === 1 ? 'babylai:bg-primary-500 babylai:text-black-white-50 babylai:max-w-[220px]' : 'babylai:bg-card'),
31121
+ className: "babylai:rounded-2xl babylai:p-4 ".concat(senderType === 1 ? "babylai:bg-primary-500 babylai:text-black-white-50 babylai:max-w-[220px]" : "babylai:bg-card"),
31122
31122
  children: jsxRuntime.jsx(Markdown, {
31123
31123
  components: {
31124
31124
  p: _ref2 => {
@@ -31127,7 +31127,8 @@ var AgentResponse = _ref => {
31127
31127
  } = _ref2,
31128
31128
  props = _objectWithoutProperties$2(_ref2, _excluded$c);
31129
31129
  return jsxRuntime.jsx("p", _objectSpread2({
31130
- className: 'babylai:m-0 babylai:leading-snug babylai:text-sm babylai:font-sans babylai:wrap-break-word babylai:text-start'
31130
+ dir: "auto",
31131
+ className: "babylai:m-0 babylai:leading-snug babylai:text-sm babylai:font-sans babylai:wrap-break-word"
31131
31132
  }, props));
31132
31133
  }
31133
31134
  },
@@ -39560,17 +39561,19 @@ var HelpscreenOption = _ref => {
39560
39561
  isSelected,
39561
39562
  onClick
39562
39563
  } = _ref;
39564
+ var _a;
39565
+ var chatWithUs = (_a = option.chatWithUs) !== null && _a !== void 0 ? _a : true;
39563
39566
  return jsxRuntime.jsxs("div", {
39564
- role: "button",
39565
- tabIndex: 0,
39566
- className: cn('babylai:flex babylai:flex-col babylai:gap-2 babylai:p-6 babylai:rounded-3xl babylai:text-start babylai:border babylai:border-black-white-200 babylai:bg-card babylai:cursor-pointer', 'babylai:transition-all babylai:duration-200 babylai:ease-out', 'babylai:active:scale-[0.98] babylai:active:opacity-95', isSelected && 'babylai:ring babylai:ring-primary-500 babylai:shadow-md'),
39567
- onClick: onClick,
39568
- onKeyDown: e => {
39567
+ role: chatWithUs ? 'button' : undefined,
39568
+ tabIndex: chatWithUs ? 0 : undefined,
39569
+ className: cn('babylai:flex babylai:flex-col babylai:gap-2 babylai:p-6 babylai:rounded-3xl babylai:text-start babylai:border babylai:border-black-white-200 babylai:bg-card', 'babylai:transition-all babylai:duration-200 babylai:ease-out', chatWithUs ? 'babylai:cursor-pointer babylai:active:scale-[0.98] babylai:active:opacity-95' : 'babylai:cursor-default', isSelected && 'babylai:ring babylai:ring-primary-500 babylai:shadow-md'),
39570
+ onClick: chatWithUs ? onClick : undefined,
39571
+ onKeyDown: chatWithUs ? e => {
39569
39572
  if (e.key === 'Enter' || e.key === ' ') {
39570
39573
  e.preventDefault();
39571
39574
  onClick();
39572
39575
  }
39573
- },
39576
+ } : undefined,
39574
39577
  children: [jsxRuntime.jsx("h2", {
39575
39578
  className: "babylai:text-base! babylai:font-semibold! babylai:text-card-foreground",
39576
39579
  dir: "auto",
@@ -39590,7 +39593,8 @@ var HelpscreenList = _ref => {
39590
39593
  selectedOption,
39591
39594
  onToggleOption,
39592
39595
  onStartChat,
39593
- showChatNowButton = true
39596
+ showChatNowButton = true,
39597
+ chatWithUs = true
39594
39598
  } = _ref;
39595
39599
  var {
39596
39600
  t
@@ -39609,7 +39613,7 @@ var HelpscreenList = _ref => {
39609
39613
  children: jsxRuntime.jsxs(Button, {
39610
39614
  variant: 'default',
39611
39615
  onClick: onStartChat,
39612
- disabled: !selectedOption,
39616
+ disabled: !selectedOption || !chatWithUs,
39613
39617
  children: [t('homeSdk.chatNow'), jsxRuntime.jsx(ForwardRef$8, {
39614
39618
  className: "babylai:w-6 babylai:h-6"
39615
39619
  })]
@@ -39626,7 +39630,7 @@ var OptionsListScreen = _ref => {
39626
39630
  handleMinimize,
39627
39631
  hasActiveSession = false
39628
39632
  } = _ref;
39629
- var _a, _b, _c, _d;
39633
+ var _a, _b, _c, _d, _e;
39630
39634
  var [selectedOption, setSelectedOption] = React.useState(null);
39631
39635
  React.useEffect(() => {
39632
39636
  // Reset selected option when helpScreen changes
@@ -39662,7 +39666,8 @@ var OptionsListScreen = _ref => {
39662
39666
  selectedOption: selectedOption,
39663
39667
  onToggleOption: handleToggleExpandOption,
39664
39668
  onStartChat: handleStartChatWithSelected,
39665
- showChatNowButton: !hasActiveSession
39669
+ showChatNowButton: !hasActiveSession,
39670
+ chatWithUs: (_e = helpScreen === null || helpScreen === void 0 ? void 0 : helpScreen.chatWithUs) !== null && _e !== void 0 ? _e : true
39666
39671
  })]
39667
39672
  }), jsxRuntime.jsx(PoweredBy, {})]
39668
39673
  });
@@ -40062,11 +40067,15 @@ var HelpPopup = _ref => {
40062
40067
  }();
40063
40068
  var handleEndChatFromChatScreen = React.useCallback(/*#__PURE__*/_asyncToGenerator(function* () {
40064
40069
  setEndChatConfirmation(false);
40070
+ if (!sessionId) {
40071
+ setShowChat(false);
40072
+ setSelectedOption(null);
40073
+ return;
40074
+ }
40065
40075
  yield onEndChat({
40066
40076
  fromChatScreen: true
40067
40077
  });
40068
- // Keep showChat and selectedOption so chat screen stays open with in-chat review
40069
- }), [onEndChat]);
40078
+ }), [onEndChat, sessionId, setSelectedOption]);
40070
40079
  var handleMinimize = React.useCallback(() => {
40071
40080
  onClose();
40072
40081
  }, [onClose]);