@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.
- package/bundle/bundle.umd.js +22 -74
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/Header/HeaderChatBotButton.d.ts +0 -1
- package/bundle/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
- package/bundle/hooks/useAspects/handleAspects.d.ts +1 -1
- package/bundle/hooks/useAspects/useAspects.d.ts +1 -1
- package/dist/components/Header/HeaderChatBotButton.d.ts +0 -1
- package/dist/components/Header/HeaderChatBotButton.js +15 -4
- package/dist/components/Header/HeaderChatBotButton.js.map +1 -1
- package/dist/components/Header/HeaderSubMenu.js +1 -1
- package/dist/components/Header/HeaderSubMenu.js.map +1 -1
- package/dist/components/Header/HeaderTop.js +1 -1
- package/dist/components/Header/HeaderTop.js.map +1 -1
- package/dist/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
- package/dist/hooks/useAspects/aspects/forwardQuery.js +1 -1
- package/dist/hooks/useAspects/aspects/forwardQuery.js.map +1 -1
- package/dist/hooks/useAspects/handleAspects.d.ts +1 -1
- package/dist/hooks/useAspects/handleAspects.js +5 -2
- package/dist/hooks/useAspects/handleAspects.js.map +1 -1
- package/dist/hooks/useAspects/useAspects.d.ts +1 -1
- package/dist/retail/utils/renderStep.js +3 -1
- package/dist/retail/utils/renderStep.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/Header/HeaderChatBotButton.d.ts +0 -1
- package/lib/components/Header/HeaderChatBotButton.js +15 -4
- package/lib/components/Header/HeaderChatBotButton.js.map +1 -1
- package/lib/components/Header/HeaderSubMenu.js +1 -1
- package/lib/components/Header/HeaderSubMenu.js.map +1 -1
- package/lib/components/Header/HeaderTop.js +1 -1
- package/lib/components/Header/HeaderTop.js.map +1 -1
- package/lib/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
- package/lib/hooks/useAspects/aspects/forwardQuery.js +1 -1
- package/lib/hooks/useAspects/aspects/forwardQuery.js.map +1 -1
- package/lib/hooks/useAspects/handleAspects.d.ts +1 -1
- package/lib/hooks/useAspects/handleAspects.js +5 -2
- package/lib/hooks/useAspects/handleAspects.js.map +1 -1
- package/lib/hooks/useAspects/useAspects.d.ts +1 -1
- package/lib/retail/utils/renderStep.js +3 -1
- package/lib/retail/utils/renderStep.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +22 -74
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/Header/HeaderChatBotButton.d.ts +0 -1
- package/mobile/bundle/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
- package/mobile/bundle/hooks/useAspects/handleAspects.d.ts +1 -1
- package/mobile/bundle/hooks/useAspects/useAspects.d.ts +1 -1
- package/mobile/dist/components/Header/HeaderChatBotButton.d.ts +0 -1
- package/mobile/dist/components/Header/HeaderChatBotButton.js +15 -4
- package/mobile/dist/components/Header/HeaderChatBotButton.js.map +1 -1
- package/mobile/dist/components/Header/HeaderSubMenu.js +1 -1
- package/mobile/dist/components/Header/HeaderSubMenu.js.map +1 -1
- package/mobile/dist/components/Header/HeaderTop.js +1 -1
- package/mobile/dist/components/Header/HeaderTop.js.map +1 -1
- package/mobile/dist/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
- package/mobile/dist/hooks/useAspects/aspects/forwardQuery.js +1 -1
- package/mobile/dist/hooks/useAspects/aspects/forwardQuery.js.map +1 -1
- package/mobile/dist/hooks/useAspects/handleAspects.d.ts +1 -1
- package/mobile/dist/hooks/useAspects/handleAspects.js +5 -2
- package/mobile/dist/hooks/useAspects/handleAspects.js.map +1 -1
- package/mobile/dist/hooks/useAspects/useAspects.d.ts +1 -1
- package/mobile/dist/retail/utils/renderStep.js +3 -1
- package/mobile/dist/retail/utils/renderStep.js.map +1 -1
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/Header/HeaderChatBotButton.d.ts +0 -1
- package/mobile/lib/components/Header/HeaderChatBotButton.js +15 -4
- package/mobile/lib/components/Header/HeaderChatBotButton.js.map +1 -1
- package/mobile/lib/components/Header/HeaderSubMenu.js +1 -1
- package/mobile/lib/components/Header/HeaderSubMenu.js.map +1 -1
- package/mobile/lib/components/Header/HeaderTop.js +1 -1
- package/mobile/lib/components/Header/HeaderTop.js.map +1 -1
- package/mobile/lib/hooks/useAspects/aspects/forwardQuery.d.ts +1 -1
- package/mobile/lib/hooks/useAspects/aspects/forwardQuery.js +1 -1
- package/mobile/lib/hooks/useAspects/aspects/forwardQuery.js.map +1 -1
- package/mobile/lib/hooks/useAspects/handleAspects.d.ts +1 -1
- package/mobile/lib/hooks/useAspects/handleAspects.js +5 -2
- package/mobile/lib/hooks/useAspects/handleAspects.js.map +1 -1
- package/mobile/lib/hooks/useAspects/useAspects.d.ts +1 -1
- package/mobile/lib/retail/utils/renderStep.js +3 -1
- package/mobile/lib/retail/utils/renderStep.js.map +1 -1
- package/mobile/src/components/Header/HeaderChatBotButton.tsx +18 -12
- package/mobile/src/components/Header/HeaderSubMenu.tsx +0 -1
- package/mobile/src/components/Header/HeaderTop.tsx +1 -6
- package/mobile/src/hooks/useAspects/aspects/forwardQuery.ts +1 -1
- package/mobile/src/hooks/useAspects/handleAspects.ts +6 -2
- package/mobile/src/hooks/useAspects/useAspects.ts +1 -1
- package/mobile/src/retail/utils/renderStep.tsx +3 -1
- package/package.json +1 -1
- package/src/components/Header/HeaderChatBotButton.tsx +18 -12
- package/src/components/Header/HeaderSubMenu.tsx +0 -1
- package/src/components/Header/HeaderTop.tsx +1 -6
- package/src/hooks/useAspects/aspects/forwardQuery.ts +1 -1
- package/src/hooks/useAspects/handleAspects.ts +6 -2
- package/src/hooks/useAspects/useAspects.ts +1 -1
- package/src/retail/utils/renderStep.tsx +3 -1
- package/bundle/components/Header/useChatBot.d.ts +0 -5
- package/dist/components/Header/useChatBot.d.ts +0 -5
- package/dist/components/Header/useChatBot.js +0 -61
- package/dist/components/Header/useChatBot.js.map +0 -1
- package/lib/components/Header/useChatBot.d.ts +0 -5
- package/lib/components/Header/useChatBot.js +0 -58
- package/lib/components/Header/useChatBot.js.map +0 -1
- package/mobile/bundle/components/Header/useChatBot.d.ts +0 -5
- package/mobile/dist/components/Header/useChatBot.d.ts +0 -5
- package/mobile/dist/components/Header/useChatBot.js +0 -61
- package/mobile/dist/components/Header/useChatBot.js.map +0 -1
- package/mobile/lib/components/Header/useChatBot.d.ts +0 -5
- package/mobile/lib/components/Header/useChatBot.js +0 -58
- package/mobile/lib/components/Header/useChatBot.js.map +0 -1
- package/mobile/src/components/Header/useChatBot.ts +0 -86
- package/src/components/Header/useChatBot.ts +0 -86
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
-
import { initializeExternalNS, initializeExternalStylesheet } from '../../hooks/useExternalNS';
|
|
3
|
-
import { type PreventableEventWithTarget } from '../../ui-kit/PreventableEvent';
|
|
4
|
-
|
|
5
|
-
const CHAT_NAMESPACE = 'chatbot';
|
|
6
|
-
const CHAT_BUTTON_EXTERNAL_NAME = 'text-page__btn-chat';
|
|
7
|
-
const CHAT_FRAME_ID = 'webchat-js-container:webchat_rshb';
|
|
8
|
-
const CHAT_STORAGE_NAME = 'webchat-keep-open';
|
|
9
|
-
const BUSINESS_CHAT_PREFIX = '/webchat-api';
|
|
10
|
-
const BUSINESS_CHAT_CLASSNAME =
|
|
11
|
-
'@container fixed right-0 bottom-0 top-0 h-full w-full z-[100] @3xl:w-auto h-fit';
|
|
12
|
-
|
|
13
|
-
const CHATBOT_URL: Record<string, string> = {
|
|
14
|
-
personal: '//chat.mes.rshb.ru/assets/js/webchat_rshb',
|
|
15
|
-
business: '/webchat',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
interface WebChat {
|
|
19
|
-
render?: (id?: string, isOpen?: boolean, prefix?: string, className?: string) => void;
|
|
20
|
-
chatOpen?: () => void;
|
|
21
|
-
chatClose?: () => void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const useChatBot = (chat?: string) => {
|
|
25
|
-
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
26
|
-
|
|
27
|
-
useEffect(() => globalThis.localStorage?.setItem(CHAT_STORAGE_NAME, String(Date.now())), []);
|
|
28
|
-
const chatUrl = CHATBOT_URL[chat ?? ''];
|
|
29
|
-
|
|
30
|
-
const load = useCallback(
|
|
31
|
-
(ev: PreventableEventWithTarget) => {
|
|
32
|
-
if (!chatUrl) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
setIsLoading(true);
|
|
37
|
-
if (chat === 'business') {
|
|
38
|
-
renderBusinessChatBot(chatUrl).finally(() => setIsLoading(false));
|
|
39
|
-
} else {
|
|
40
|
-
renderPersonalChatBot(ev, chatUrl).finally(() => setIsLoading(false));
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
[chatUrl, chat],
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
return { load, isLoading };
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const renderPersonalChatBot = async (ev: PreventableEventWithTarget, chatUrl: string) => {
|
|
50
|
-
const target = ev.target as HTMLElement;
|
|
51
|
-
|
|
52
|
-
if (!target?.classList.contains(CHAT_BUTTON_EXTERNAL_NAME)) {
|
|
53
|
-
target?.classList.add(CHAT_BUTTON_EXTERNAL_NAME);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const chatFrame = globalThis.document.getElementById(CHAT_FRAME_ID);
|
|
57
|
-
if (!chatFrame) {
|
|
58
|
-
await initializeExternalNS(CHAT_NAMESPACE, chatUrl);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const renderBusinessChatBot = async (chatUrl: string) => {
|
|
63
|
-
const businessChat = (await initializeExternalNS(
|
|
64
|
-
CHAT_NAMESPACE,
|
|
65
|
-
`${chatUrl}/bundle.js`,
|
|
66
|
-
true,
|
|
67
|
-
)) as WebChat;
|
|
68
|
-
|
|
69
|
-
initializeExternalStylesheet(`${chatUrl}/bundle.css`);
|
|
70
|
-
|
|
71
|
-
const chatFrame = globalThis.document.getElementById(CHAT_FRAME_ID);
|
|
72
|
-
if (chatFrame) {
|
|
73
|
-
businessChat?.chatOpen?.();
|
|
74
|
-
} else {
|
|
75
|
-
createChatFrame();
|
|
76
|
-
|
|
77
|
-
businessChat?.render?.(CHAT_FRAME_ID, true, BUSINESS_CHAT_PREFIX, BUSINESS_CHAT_CLASSNAME);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const createChatFrame = () => {
|
|
82
|
-
const chatFrame = globalThis.document.createElement('div');
|
|
83
|
-
chatFrame.id = CHAT_FRAME_ID;
|
|
84
|
-
|
|
85
|
-
globalThis.document.body.appendChild(chatFrame);
|
|
86
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
-
import { initializeExternalNS, initializeExternalStylesheet } from '../../hooks/useExternalNS';
|
|
3
|
-
import { type PreventableEventWithTarget } from '../../ui-kit/PreventableEvent';
|
|
4
|
-
|
|
5
|
-
const CHAT_NAMESPACE = 'chatbot';
|
|
6
|
-
const CHAT_BUTTON_EXTERNAL_NAME = 'text-page__btn-chat';
|
|
7
|
-
const CHAT_FRAME_ID = 'webchat-js-container:webchat_rshb';
|
|
8
|
-
const CHAT_STORAGE_NAME = 'webchat-keep-open';
|
|
9
|
-
const BUSINESS_CHAT_PREFIX = '/webchat-api';
|
|
10
|
-
const BUSINESS_CHAT_CLASSNAME =
|
|
11
|
-
'@container fixed right-0 bottom-0 top-0 h-full w-full z-[100] @3xl:w-auto h-fit';
|
|
12
|
-
|
|
13
|
-
const CHATBOT_URL: Record<string, string> = {
|
|
14
|
-
personal: '//chat.mes.rshb.ru/assets/js/webchat_rshb',
|
|
15
|
-
business: '/webchat',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
interface WebChat {
|
|
19
|
-
render?: (id?: string, isOpen?: boolean, prefix?: string, className?: string) => void;
|
|
20
|
-
chatOpen?: () => void;
|
|
21
|
-
chatClose?: () => void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const useChatBot = (chat?: string) => {
|
|
25
|
-
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
26
|
-
|
|
27
|
-
useEffect(() => globalThis.localStorage?.setItem(CHAT_STORAGE_NAME, String(Date.now())), []);
|
|
28
|
-
const chatUrl = CHATBOT_URL[chat ?? ''];
|
|
29
|
-
|
|
30
|
-
const load = useCallback(
|
|
31
|
-
(ev: PreventableEventWithTarget) => {
|
|
32
|
-
if (!chatUrl) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
setIsLoading(true);
|
|
37
|
-
if (chat === 'business') {
|
|
38
|
-
renderBusinessChatBot(chatUrl).finally(() => setIsLoading(false));
|
|
39
|
-
} else {
|
|
40
|
-
renderPersonalChatBot(ev, chatUrl).finally(() => setIsLoading(false));
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
[chatUrl, chat],
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
return { load, isLoading };
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const renderPersonalChatBot = async (ev: PreventableEventWithTarget, chatUrl: string) => {
|
|
50
|
-
const target = ev.target as HTMLElement;
|
|
51
|
-
|
|
52
|
-
if (!target?.classList.contains(CHAT_BUTTON_EXTERNAL_NAME)) {
|
|
53
|
-
target?.classList.add(CHAT_BUTTON_EXTERNAL_NAME);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const chatFrame = globalThis.document.getElementById(CHAT_FRAME_ID);
|
|
57
|
-
if (!chatFrame) {
|
|
58
|
-
await initializeExternalNS(CHAT_NAMESPACE, chatUrl);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const renderBusinessChatBot = async (chatUrl: string) => {
|
|
63
|
-
const businessChat = (await initializeExternalNS(
|
|
64
|
-
CHAT_NAMESPACE,
|
|
65
|
-
`${chatUrl}/bundle.js`,
|
|
66
|
-
true,
|
|
67
|
-
)) as WebChat;
|
|
68
|
-
|
|
69
|
-
initializeExternalStylesheet(`${chatUrl}/bundle.css`);
|
|
70
|
-
|
|
71
|
-
const chatFrame = globalThis.document.getElementById(CHAT_FRAME_ID);
|
|
72
|
-
if (chatFrame) {
|
|
73
|
-
businessChat?.chatOpen?.();
|
|
74
|
-
} else {
|
|
75
|
-
createChatFrame();
|
|
76
|
-
|
|
77
|
-
businessChat?.render?.(CHAT_FRAME_ID, true, BUSINESS_CHAT_PREFIX, BUSINESS_CHAT_CLASSNAME);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const createChatFrame = () => {
|
|
82
|
-
const chatFrame = globalThis.document.createElement('div');
|
|
83
|
-
chatFrame.id = CHAT_FRAME_ID;
|
|
84
|
-
|
|
85
|
-
globalThis.document.body.appendChild(chatFrame);
|
|
86
|
-
};
|