@redneckz/wildless-cms-uni-blocks 0.14.775 → 0.14.776

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.
Files changed (47) hide show
  1. package/bundle/bundle.umd.js +15 -12
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/Header/HeaderSecondaryMenuButton.d.ts +1 -0
  4. package/bundle/components/Header/useChatBot.d.ts +4 -1
  5. package/dist/components/Header/HeaderChatBotButton.js +2 -2
  6. package/dist/components/Header/HeaderChatBotButton.js.map +1 -1
  7. package/dist/components/Header/HeaderSecondaryMenuButton.d.ts +1 -0
  8. package/dist/components/Header/HeaderSecondaryMenuButton.js +3 -3
  9. package/dist/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  10. package/dist/components/Header/useChatBot.d.ts +4 -1
  11. package/dist/components/Header/useChatBot.js +9 -6
  12. package/dist/components/Header/useChatBot.js.map +1 -1
  13. package/lib/components/Header/HeaderChatBotButton.js +2 -2
  14. package/lib/components/Header/HeaderChatBotButton.js.map +1 -1
  15. package/lib/components/Header/HeaderSecondaryMenuButton.d.ts +1 -0
  16. package/lib/components/Header/HeaderSecondaryMenuButton.js +3 -3
  17. package/lib/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  18. package/lib/components/Header/useChatBot.d.ts +4 -1
  19. package/lib/components/Header/useChatBot.js +10 -7
  20. package/lib/components/Header/useChatBot.js.map +1 -1
  21. package/mobile/bundle/bundle.umd.js +1 -1
  22. package/mobile/bundle/bundle.umd.min.js +1 -1
  23. package/mobile/bundle/components/Header/HeaderSecondaryMenuButton.d.ts +1 -0
  24. package/mobile/bundle/components/Header/useChatBot.d.ts +4 -1
  25. package/mobile/dist/components/Header/HeaderChatBotButton.js +2 -2
  26. package/mobile/dist/components/Header/HeaderChatBotButton.js.map +1 -1
  27. package/mobile/dist/components/Header/HeaderSecondaryMenuButton.d.ts +1 -0
  28. package/mobile/dist/components/Header/HeaderSecondaryMenuButton.js +3 -3
  29. package/mobile/dist/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  30. package/mobile/dist/components/Header/useChatBot.d.ts +4 -1
  31. package/mobile/dist/components/Header/useChatBot.js +9 -6
  32. package/mobile/dist/components/Header/useChatBot.js.map +1 -1
  33. package/mobile/lib/components/Header/HeaderChatBotButton.js +2 -2
  34. package/mobile/lib/components/Header/HeaderChatBotButton.js.map +1 -1
  35. package/mobile/lib/components/Header/HeaderSecondaryMenuButton.d.ts +1 -0
  36. package/mobile/lib/components/Header/HeaderSecondaryMenuButton.js +3 -3
  37. package/mobile/lib/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  38. package/mobile/lib/components/Header/useChatBot.d.ts +4 -1
  39. package/mobile/lib/components/Header/useChatBot.js +10 -7
  40. package/mobile/lib/components/Header/useChatBot.js.map +1 -1
  41. package/mobile/src/components/Header/HeaderChatBotButton.tsx +2 -1
  42. package/mobile/src/components/Header/HeaderSecondaryMenuButton.tsx +13 -7
  43. package/mobile/src/components/Header/useChatBot.ts +23 -14
  44. package/package.json +1 -1
  45. package/src/components/Header/HeaderChatBotButton.tsx +2 -1
  46. package/src/components/Header/HeaderSecondaryMenuButton.tsx +13 -7
  47. package/src/components/Header/useChatBot.ts +23 -14
@@ -5017,14 +5017,14 @@
5017
5017
  default: 'w-6 h-6',
5018
5018
  large: 'w-12 h-12',
5019
5019
  };
5020
- const HeaderSecondaryMenuButton = JSX(({ className, isRounded, buttonSize = 'default', isGrayBg = false, disabled, ariaLabel = 'Меню второго уровня', image, data, onClick, version, }) => {
5020
+ const HeaderSecondaryMenuButton = JSX(({ className, isRounded, buttonSize = 'default', isGrayBg = false, disabled, ariaLabel = 'Меню второго уровня', image, data, onClick, version, isLoading, }) => {
5021
5021
  const grayBg = isGrayBg && !isRounded ? 'bg-main-divider' : '';
5022
5022
  const bgColor = version === 'transparent' ? 'backdrop-opacity-30 bg-white/30' : grayBg;
5023
5023
  return (jsx("button", { className: style('group/btn border-0 flex shrink-0 items-center', isGrayBg ? 'p-s rounded-full' : 'p-0 bg-inherit', bgColor, isRounded
5024
5024
  ? 'w-8 h-8 text-secondary-light hover:text-secondary-hove'
5025
- : `${BUTTON_SIZE_STYLE[buttonSize]} text-primary-text hover:text-primary-main`, 'group-data-transparent:text-white', className), type: "button", disabled: disabled, "aria-label": ariaLabel, onClick: onClick, ...getAspectsAttributes(data), children: jsx(Img, { image: image, className: style('h-full', {
5025
+ : `${BUTTON_SIZE_STYLE[buttonSize]} text-primary-text hover:text-primary-main`, 'group-data-transparent:text-white', className), type: "button", disabled: disabled, "aria-label": ariaLabel, onClick: onClick, ...getAspectsAttributes(data), children: isLoading ? (jsx("div", { className: "w-full h-full rounded-full border-4 border-r-transparent animate-spin text-primary-main" })) : (jsx(Img, { image: image, className: style('h-full', {
5026
5026
  'bg-main-divider/20 rounded-full': isRounded,
5027
- }), imageClassName: "group-hover/btn:text-primary-hover group-hover/btn:invert-0" }) }));
5027
+ }), imageClassName: "group-hover/btn:text-primary-hover group-hover/btn:invert-0" })) }));
5028
5028
  });
5029
5029
 
5030
5030
  const getNS = (_) => globalThis[_];
@@ -5108,28 +5108,31 @@
5108
5108
  business: '/webchat',
5109
5109
  };
5110
5110
  const useChatBot = (chat) => {
5111
+ const [isLoading, setIsLoading] = useState(false);
5111
5112
  useEffect(() => globalThis.localStorage?.setItem(CHAT_STORAGE_NAME, String(Date.now())), []);
5112
5113
  const chatUrl = CHATBOT_URL[chat ?? ''];
5113
- return async (ev) => {
5114
+ const load = useCallback((ev) => {
5114
5115
  if (!chatUrl) {
5115
5116
  return;
5116
5117
  }
5118
+ setIsLoading(true);
5117
5119
  if (chat === 'business') {
5118
- await renderBusinessChatBot(chatUrl);
5120
+ renderBusinessChatBot(chatUrl).finally(() => setIsLoading(false));
5119
5121
  }
5120
5122
  else {
5121
- renderPersonalChatBot(ev, chatUrl);
5123
+ renderPersonalChatBot(ev, chatUrl).finally(() => setIsLoading(false));
5122
5124
  }
5123
- };
5125
+ }, [chatUrl, chat]);
5126
+ return { load, isLoading };
5124
5127
  };
5125
- const renderPersonalChatBot = (ev, chatUrl) => {
5128
+ const renderPersonalChatBot = async (ev, chatUrl) => {
5126
5129
  const target = ev.target;
5127
5130
  if (!target?.classList.contains(CHAT_BUTTON_EXTERNAL_NAME)) {
5128
5131
  target?.classList.add(CHAT_BUTTON_EXTERNAL_NAME);
5129
5132
  }
5130
5133
  const chatFrame = globalThis.document.getElementById(CHAT_FRAME_ID);
5131
5134
  if (!chatFrame) {
5132
- initializeExternalNS(CHAT_NAMESPACE, chatUrl);
5135
+ await initializeExternalNS(CHAT_NAMESPACE, chatUrl);
5133
5136
  }
5134
5137
  };
5135
5138
  const renderBusinessChatBot = async (chatUrl) => {
@@ -5154,8 +5157,8 @@
5154
5157
  };
5155
5158
 
5156
5159
  const HeaderChatBotButton = JSX(({ chat = 'personal', iconVersion, className, ariaLabel = 'Чат', version }) => {
5157
- const load = useChatBot(chat);
5158
- return (jsx(HeaderSecondaryMenuButton, { className: className, image: { icon: 'HeadphonesIcon', iconVersion }, ariaLabel: ariaLabel, onClick: load, buttonSize: "large", isGrayBg: true, version: version }));
5160
+ const { load, isLoading } = useChatBot(chat);
5161
+ return (jsx(HeaderSecondaryMenuButton, { className: className, image: { icon: 'HeadphonesIcon', iconVersion }, ariaLabel: ariaLabel, onClick: load, buttonSize: "large", isGrayBg: true, version: version, isLoading: isLoading }));
5159
5162
  });
5160
5163
 
5161
5164
  const HeaderItem = JSX(({ className = '', active, dataItemName, children, data, ...rest }) => {
@@ -7035,7 +7038,7 @@
7035
7038
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
7036
7039
  });
7037
7040
 
7038
- const packageVersion = "0.14.774";
7041
+ const packageVersion = "0.14.775";
7039
7042
 
7040
7043
  exports.Blocks = Blocks;
7041
7044
  exports.ContentPage = ContentPage;