@redneckz/wildless-cms-uni-blocks 0.14.846 → 0.14.850

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 (109) hide show
  1. package/bundle/bundle.umd.js +22 -74
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/Header/HeaderChatBotButton.d.ts +0 -1
  4. package/bundle/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
  5. package/bundle/hooks/useAspects/handleAspects.d.ts +1 -1
  6. package/bundle/hooks/useAspects/useAspects.d.ts +1 -1
  7. package/dist/components/Header/HeaderChatBotButton.d.ts +0 -1
  8. package/dist/components/Header/HeaderChatBotButton.js +15 -4
  9. package/dist/components/Header/HeaderChatBotButton.js.map +1 -1
  10. package/dist/components/Header/HeaderSubMenu.js +1 -1
  11. package/dist/components/Header/HeaderSubMenu.js.map +1 -1
  12. package/dist/components/Header/HeaderTop.js +1 -1
  13. package/dist/components/Header/HeaderTop.js.map +1 -1
  14. package/dist/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
  15. package/dist/hooks/useAspects/aspects/forwardQuery.js +1 -1
  16. package/dist/hooks/useAspects/aspects/forwardQuery.js.map +1 -1
  17. package/dist/hooks/useAspects/handleAspects.d.ts +1 -1
  18. package/dist/hooks/useAspects/handleAspects.js +5 -2
  19. package/dist/hooks/useAspects/handleAspects.js.map +1 -1
  20. package/dist/hooks/useAspects/useAspects.d.ts +1 -1
  21. package/dist/retail/utils/renderStep.js +3 -1
  22. package/dist/retail/utils/renderStep.js.map +1 -1
  23. package/lib/common.css +1 -1
  24. package/lib/components/Header/HeaderChatBotButton.d.ts +0 -1
  25. package/lib/components/Header/HeaderChatBotButton.js +15 -4
  26. package/lib/components/Header/HeaderChatBotButton.js.map +1 -1
  27. package/lib/components/Header/HeaderSubMenu.js +1 -1
  28. package/lib/components/Header/HeaderSubMenu.js.map +1 -1
  29. package/lib/components/Header/HeaderTop.js +1 -1
  30. package/lib/components/Header/HeaderTop.js.map +1 -1
  31. package/lib/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
  32. package/lib/hooks/useAspects/aspects/forwardQuery.js +1 -1
  33. package/lib/hooks/useAspects/aspects/forwardQuery.js.map +1 -1
  34. package/lib/hooks/useAspects/handleAspects.d.ts +1 -1
  35. package/lib/hooks/useAspects/handleAspects.js +5 -2
  36. package/lib/hooks/useAspects/handleAspects.js.map +1 -1
  37. package/lib/hooks/useAspects/useAspects.d.ts +1 -1
  38. package/lib/retail/utils/renderStep.js +3 -1
  39. package/lib/retail/utils/renderStep.js.map +1 -1
  40. package/mobile/bundle/bundle.umd.js +22 -74
  41. package/mobile/bundle/bundle.umd.min.js +1 -1
  42. package/mobile/bundle/components/Header/HeaderChatBotButton.d.ts +0 -1
  43. package/mobile/bundle/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
  44. package/mobile/bundle/hooks/useAspects/handleAspects.d.ts +1 -1
  45. package/mobile/bundle/hooks/useAspects/useAspects.d.ts +1 -1
  46. package/mobile/dist/components/Header/HeaderChatBotButton.d.ts +0 -1
  47. package/mobile/dist/components/Header/HeaderChatBotButton.js +15 -4
  48. package/mobile/dist/components/Header/HeaderChatBotButton.js.map +1 -1
  49. package/mobile/dist/components/Header/HeaderSubMenu.js +1 -1
  50. package/mobile/dist/components/Header/HeaderSubMenu.js.map +1 -1
  51. package/mobile/dist/components/Header/HeaderTop.js +1 -1
  52. package/mobile/dist/components/Header/HeaderTop.js.map +1 -1
  53. package/mobile/dist/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
  54. package/mobile/dist/hooks/useAspects/aspects/forwardQuery.js +1 -1
  55. package/mobile/dist/hooks/useAspects/aspects/forwardQuery.js.map +1 -1
  56. package/mobile/dist/hooks/useAspects/handleAspects.d.ts +1 -1
  57. package/mobile/dist/hooks/useAspects/handleAspects.js +5 -2
  58. package/mobile/dist/hooks/useAspects/handleAspects.js.map +1 -1
  59. package/mobile/dist/hooks/useAspects/useAspects.d.ts +1 -1
  60. package/mobile/dist/retail/utils/renderStep.js +3 -1
  61. package/mobile/dist/retail/utils/renderStep.js.map +1 -1
  62. package/mobile/lib/common.css +1 -1
  63. package/mobile/lib/components/Header/HeaderChatBotButton.d.ts +0 -1
  64. package/mobile/lib/components/Header/HeaderChatBotButton.js +15 -4
  65. package/mobile/lib/components/Header/HeaderChatBotButton.js.map +1 -1
  66. package/mobile/lib/components/Header/HeaderSubMenu.js +1 -1
  67. package/mobile/lib/components/Header/HeaderSubMenu.js.map +1 -1
  68. package/mobile/lib/components/Header/HeaderTop.js +1 -1
  69. package/mobile/lib/components/Header/HeaderTop.js.map +1 -1
  70. package/mobile/lib/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
  71. package/mobile/lib/hooks/useAspects/aspects/forwardQuery.js +1 -1
  72. package/mobile/lib/hooks/useAspects/aspects/forwardQuery.js.map +1 -1
  73. package/mobile/lib/hooks/useAspects/handleAspects.d.ts +1 -1
  74. package/mobile/lib/hooks/useAspects/handleAspects.js +5 -2
  75. package/mobile/lib/hooks/useAspects/handleAspects.js.map +1 -1
  76. package/mobile/lib/hooks/useAspects/useAspects.d.ts +1 -1
  77. package/mobile/lib/retail/utils/renderStep.js +3 -1
  78. package/mobile/lib/retail/utils/renderStep.js.map +1 -1
  79. package/mobile/src/components/Header/HeaderChatBotButton.tsx +18 -12
  80. package/mobile/src/components/Header/HeaderSubMenu.tsx +0 -1
  81. package/mobile/src/components/Header/HeaderTop.tsx +1 -6
  82. package/mobile/src/hooks/useAspects/aspects/forwardQuery.ts +1 -1
  83. package/mobile/src/hooks/useAspects/handleAspects.ts +6 -2
  84. package/mobile/src/hooks/useAspects/useAspects.ts +1 -1
  85. package/mobile/src/retail/utils/renderStep.tsx +3 -1
  86. package/package.json +1 -1
  87. package/src/components/Header/HeaderChatBotButton.tsx +18 -12
  88. package/src/components/Header/HeaderSubMenu.tsx +0 -1
  89. package/src/components/Header/HeaderTop.tsx +1 -6
  90. package/src/hooks/useAspects/aspects/forwardQuery.ts +1 -1
  91. package/src/hooks/useAspects/handleAspects.ts +6 -2
  92. package/src/hooks/useAspects/useAspects.ts +1 -1
  93. package/src/retail/utils/renderStep.tsx +3 -1
  94. package/bundle/components/Header/useChatBot.d.ts +0 -5
  95. package/dist/components/Header/useChatBot.d.ts +0 -5
  96. package/dist/components/Header/useChatBot.js +0 -61
  97. package/dist/components/Header/useChatBot.js.map +0 -1
  98. package/lib/components/Header/useChatBot.d.ts +0 -5
  99. package/lib/components/Header/useChatBot.js +0 -58
  100. package/lib/components/Header/useChatBot.js.map +0 -1
  101. package/mobile/bundle/components/Header/useChatBot.d.ts +0 -5
  102. package/mobile/dist/components/Header/useChatBot.d.ts +0 -5
  103. package/mobile/dist/components/Header/useChatBot.js +0 -61
  104. package/mobile/dist/components/Header/useChatBot.js.map +0 -1
  105. package/mobile/lib/components/Header/useChatBot.d.ts +0 -5
  106. package/mobile/lib/components/Header/useChatBot.js +0 -58
  107. package/mobile/lib/components/Header/useChatBot.js.map +0 -1
  108. package/mobile/src/components/Header/useChatBot.ts +0 -86
  109. package/src/components/Header/useChatBot.ts +0 -86
@@ -1057,9 +1057,12 @@
1057
1057
  : { secondaryPhoneNumber: formatPhone(secondaryPhone) };
1058
1058
  };
1059
1059
 
1060
- const handleAspects = ({ aspectsAttributes, aspects, ev }) => {
1060
+ const handleAspects = async ({ aspectsAttributes, aspects, ev }) => {
1061
1061
  for (const { aspectName, params } of aspectsAttributes ?? []) {
1062
- aspects[aspectName ?? '']?.(ev, params);
1062
+ const aspectFn = aspects[aspectName ?? ''];
1063
+ if (aspectFn) {
1064
+ await aspectFn(ev, params);
1065
+ }
1063
1066
  }
1064
1067
  };
1065
1068
 
@@ -1102,7 +1105,7 @@
1102
1105
  return url.toString();
1103
1106
  };
1104
1107
 
1105
- const forwardQuery = (ev) => {
1108
+ const forwardQuery = async (ev) => {
1106
1109
  const anchor = ev.target?.closest('a');
1107
1110
  const navigator = locationNavigator();
1108
1111
  if (isURL(anchor?.href) && !anchor?.href?.startsWith(navigator.origin)) {
@@ -3510,16 +3513,6 @@
3510
3513
  });
3511
3514
  }
3512
3515
  };
3513
- const initializeExternalStylesheet = (url = '') => {
3514
- const link = globalThis.document.getElementById(url);
3515
- if (!link) {
3516
- const newLink = globalThis.document.createElement('link');
3517
- newLink.href = url;
3518
- newLink.id = url;
3519
- newLink.rel = 'stylesheet';
3520
- globalThis.document.head.appendChild(newLink);
3521
- }
3522
- };
3523
3516
  function useExternalNS(namespaceName, url, unmountNS = true) {
3524
3517
  const [externalNS, setExternalNS] = useState(undefined);
3525
3518
  useEffect(() => {
@@ -7807,7 +7800,9 @@
7807
7800
  const cleanElements = [
7808
7801
  !checkCondition({ condition }, getValue(field)) ? renderTitle(title) : null,
7809
7802
  ...renderInputs({ field, inputs, params }),
7810
- ].filter(Boolean);
7803
+ ]
7804
+ .filter(Boolean)
7805
+ .map((_, j) => ({ ..._, key: _.key ?? `elem-${j}` }));
7811
7806
  return cleanElements.length ? (jsx("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: cleanElements }, `section-${i}`)) : null;
7812
7807
  });
7813
7808
  const getValue = (field) => (name) => field(name)?.value;
@@ -9860,65 +9855,18 @@
9860
9855
  });
9861
9856
  const getDataTestIdAttribute = (dataTestId) => dataTestId ? { 'data-test-id': dataTestId } : null;
9862
9857
 
9863
- const CHAT_NAMESPACE = 'chatbot';
9864
- const CHAT_BUTTON_EXTERNAL_NAME = 'text-page__btn-chat';
9865
- const CHAT_FRAME_ID = 'webchat-js-container:webchat_rshb';
9866
- const CHAT_STORAGE_NAME = 'webchat-keep-open';
9867
- const BUSINESS_CHAT_PREFIX = '/webchat-api';
9868
- const BUSINESS_CHAT_CLASSNAME = '@container fixed right-0 bottom-0 top-0 h-full w-full z-[100] @3xl:w-auto h-fit';
9869
- const CHATBOT_URL = {
9870
- personal: '//chat.mes.rshb.ru/assets/js/webchat_rshb',
9871
- business: '/webchat',
9872
- };
9873
- const useChatBot = (chat) => {
9874
- const [isLoading, setIsLoading] = useState(false);
9875
- useEffect(() => globalThis.localStorage?.setItem(CHAT_STORAGE_NAME, String(Date.now())), []);
9876
- const chatUrl = CHATBOT_URL[chat ?? ''];
9877
- const load = useCallback((ev) => {
9878
- if (!chatUrl) {
9879
- return;
9880
- }
9881
- setIsLoading(true);
9882
- if (chat === 'business') {
9883
- renderBusinessChatBot(chatUrl).finally(() => setIsLoading(false));
9884
- }
9885
- else {
9886
- renderPersonalChatBot(ev, chatUrl).finally(() => setIsLoading(false));
9858
+ const CHAT_BOT_ASPECT_NAME = 'openChatBot';
9859
+ const HeaderChatBotButton = JSX(({ iconVersion, className, ariaLabel = 'Чат', version, buttonSize = 'large' }) => {
9860
+ const [isLoading, { setTrue: startLoad, setFalse: endLoad }] = useBool(false);
9861
+ const aspects = useAspects();
9862
+ const handleClick = useCallback((ev) => {
9863
+ const openChatBot = aspects[CHAT_BOT_ASPECT_NAME];
9864
+ if (openChatBot) {
9865
+ startLoad();
9866
+ openChatBot(ev).finally(endLoad);
9887
9867
  }
9888
- }, [chatUrl, chat]);
9889
- return { load, isLoading };
9890
- };
9891
- const renderPersonalChatBot = async (ev, chatUrl) => {
9892
- const target = ev.target;
9893
- if (!target?.classList.contains(CHAT_BUTTON_EXTERNAL_NAME)) {
9894
- target?.classList.add(CHAT_BUTTON_EXTERNAL_NAME);
9895
- }
9896
- const chatFrame = globalThis.document.getElementById(CHAT_FRAME_ID);
9897
- if (!chatFrame) {
9898
- await initializeExternalNS(CHAT_NAMESPACE, chatUrl);
9899
- }
9900
- };
9901
- const renderBusinessChatBot = async (chatUrl) => {
9902
- const businessChat = (await initializeExternalNS(CHAT_NAMESPACE, `${chatUrl}/bundle.js`, true));
9903
- initializeExternalStylesheet(`${chatUrl}/bundle.css`);
9904
- const chatFrame = globalThis.document.getElementById(CHAT_FRAME_ID);
9905
- if (chatFrame) {
9906
- businessChat?.chatOpen?.();
9907
- }
9908
- else {
9909
- createChatFrame();
9910
- businessChat?.render?.(CHAT_FRAME_ID, true, BUSINESS_CHAT_PREFIX, BUSINESS_CHAT_CLASSNAME);
9911
- }
9912
- };
9913
- const createChatFrame = () => {
9914
- const chatFrame = globalThis.document.createElement('div');
9915
- chatFrame.id = CHAT_FRAME_ID;
9916
- globalThis.document.body.appendChild(chatFrame);
9917
- };
9918
-
9919
- const HeaderChatBotButton = JSX(({ chat = 'personal', iconVersion, className, ariaLabel = 'Чат', version, buttonSize = 'large', }) => {
9920
- const { load, isLoading } = useChatBot(chat);
9921
- return (jsx(HeaderSecondaryMenuButton, { className: className, image: { icon: 'ChatBotIcon', iconVersion }, ariaLabel: ariaLabel, onClick: load, buttonSize: buttonSize, isGrayBg: true, version: version, isLoading: isLoading, dataTestId: "chat icon" }));
9868
+ }, []);
9869
+ return (jsx(HeaderSecondaryMenuButton, { className: className, image: { icon: 'ChatBotIcon', iconVersion }, ariaLabel: ariaLabel, onClick: handleClick, buttonSize: buttonSize, isGrayBg: true, version: version, isLoading: isLoading, disabled: isLoading, dataTestId: "chat icon" }));
9922
9870
  });
9923
9871
 
9924
9872
  const HeaderItem = JSX(({ className = '', active, dataItemName, children, data, ...rest }) => {
@@ -9963,7 +9911,7 @@
9963
9911
  ? handleIntersectionActivation$1(index)
9964
9912
  : handleIntersectionDeactivation$1(index));
9965
9913
  }), [subItems]);
9966
- return (jsxs("nav", { className: "mt-s flex gap-s items-center justify-between", children: [jsx("div", { ref: subItemsListRef, className: "overflow-hidden whitespace-nowrap pb-s mt-xs space-x-lg", role: "menu", children: subItems.map((_, i) => (jsx(HeaderSubMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeSubItem, observerOptions: observerOptions, onVisibilityChange: subItemsVisibilityHandlers[i], data: _.dataHeader, ..._ }, String(i)))) }), dropDownMenuItems.length ? (jsx(DropdownMenu, { items: dropDownMenuItems, activeItem: activeSubItem, ariaLabel: dropdownMenuAriaLabel })) : null, projectSettings.CHAT_BOT ? (jsx(HeaderChatBotButton, { version: version, iconVersion: iconVersion, chat: projectSettings.CHAT_BOT, ariaLabel: chatBotAriaLabel })) : null, jsx(InternetBankButton, { version: version, ...internetBankButton })] }));
9914
+ return (jsxs("nav", { className: "mt-s flex gap-s items-center justify-between", children: [jsx("div", { ref: subItemsListRef, className: "overflow-hidden whitespace-nowrap pb-s mt-xs space-x-lg", role: "menu", children: subItems.map((_, i) => (jsx(HeaderSubMenuItem, { className: visibleItemsCount - 1 < i ? 'invisible' : '', active: _ === activeSubItem, observerOptions: observerOptions, onVisibilityChange: subItemsVisibilityHandlers[i], data: _.dataHeader, ..._ }, String(i)))) }), dropDownMenuItems.length ? (jsx(DropdownMenu, { items: dropDownMenuItems, activeItem: activeSubItem, ariaLabel: dropdownMenuAriaLabel })) : null, projectSettings.CHAT_BOT ? (jsx(HeaderChatBotButton, { version: version, iconVersion: iconVersion, ariaLabel: chatBotAriaLabel })) : null, jsx(InternetBankButton, { version: version, ...internetBankButton })] }));
9967
9915
  });
9968
9916
  const handleIntersectionActivation$1 = (index) => (prev) => Math.max(prev, index + 1);
9969
9917
  const handleIntersectionDeactivation$1 = (index) => (prev) => Math.min(prev, index);
@@ -11037,7 +10985,7 @@
11037
10985
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
11038
10986
  });
11039
10987
 
11040
- const packageVersion = "0.14.845";
10988
+ const packageVersion = "0.14.849";
11041
10989
 
11042
10990
  exports.Blocks = Blocks;
11043
10991
  exports.ContentPage = ContentPage;