@redneckz/wildless-cms-uni-blocks 0.14.770 → 0.14.772

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 (53) hide show
  1. package/bundle/bundle.umd.js +19 -26
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/Header/useChatBot.d.ts +1 -1
  4. package/bundle/utils/url.d.ts +2 -2
  5. package/dist/components/Header/useChatBot.d.ts +1 -1
  6. package/dist/components/Header/useChatBot.js +7 -3
  7. package/dist/components/Header/useChatBot.js.map +1 -1
  8. package/dist/utils/url.d.ts +2 -2
  9. package/dist/utils/url.js +10 -2
  10. package/dist/utils/url.js.map +1 -1
  11. package/lib/components/Header/useChatBot.d.ts +1 -1
  12. package/lib/components/Header/useChatBot.js +7 -3
  13. package/lib/components/Header/useChatBot.js.map +1 -1
  14. package/lib/utils/url.d.ts +2 -2
  15. package/lib/utils/url.js +9 -1
  16. package/lib/utils/url.js.map +1 -1
  17. package/mobile/bundle/bundle.umd.js +12 -23
  18. package/mobile/bundle/bundle.umd.min.js +1 -1
  19. package/mobile/bundle/components/Header/useChatBot.d.ts +1 -1
  20. package/mobile/bundle/utils/url.d.ts +2 -2
  21. package/mobile/dist/components/Header/useChatBot.d.ts +1 -1
  22. package/mobile/dist/components/Header/useChatBot.js +7 -3
  23. package/mobile/dist/components/Header/useChatBot.js.map +1 -1
  24. package/mobile/dist/utils/url.d.ts +2 -2
  25. package/mobile/dist/utils/url.js +10 -2
  26. package/mobile/dist/utils/url.js.map +1 -1
  27. package/mobile/lib/components/Header/useChatBot.d.ts +1 -1
  28. package/mobile/lib/components/Header/useChatBot.js +7 -3
  29. package/mobile/lib/components/Header/useChatBot.js.map +1 -1
  30. package/mobile/lib/utils/url.d.ts +2 -2
  31. package/mobile/lib/utils/url.js +9 -1
  32. package/mobile/lib/utils/url.js.map +1 -1
  33. package/mobile/src/components/Header/useChatBot.ts +17 -3
  34. package/mobile/src/utils/url.ts +11 -2
  35. package/package.json +1 -1
  36. package/src/components/Header/useChatBot.ts +17 -3
  37. package/src/utils/url.ts +11 -2
  38. package/bundle/utils/joinPath.d.ts +0 -2
  39. package/dist/utils/joinPath.d.ts +0 -2
  40. package/dist/utils/joinPath.js +0 -24
  41. package/dist/utils/joinPath.js.map +0 -1
  42. package/lib/utils/joinPath.d.ts +0 -2
  43. package/lib/utils/joinPath.js +0 -20
  44. package/lib/utils/joinPath.js.map +0 -1
  45. package/mobile/bundle/utils/joinPath.d.ts +0 -2
  46. package/mobile/dist/utils/joinPath.d.ts +0 -2
  47. package/mobile/dist/utils/joinPath.js +0 -24
  48. package/mobile/dist/utils/joinPath.js.map +0 -1
  49. package/mobile/lib/utils/joinPath.d.ts +0 -2
  50. package/mobile/lib/utils/joinPath.js +0 -20
  51. package/mobile/lib/utils/joinPath.js.map +0 -1
  52. package/mobile/src/utils/joinPath.ts +0 -24
  53. package/src/utils/joinPath.ts +0 -24
@@ -231,30 +231,19 @@
231
231
  return /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}(\/revs\/[0-9]{1,20})?$/.test(src);
232
232
  };
233
233
 
234
- const PLACEHOLDER = 'http://_';
235
- const joinPath = (...path) => {
236
- const urls = path.filter(Boolean).map((_) => new URL(_, PLACEHOLDER));
237
- const origin = urls.find((_) => _.origin !== PLACEHOLDER)?.origin;
238
- const pathname = cleanPath(urls.map((_) => _.pathname));
239
- const query = joinSearchParams(...urls.map((_) => _.searchParams)).toString();
240
- const hash = urls.find((_) => _.hash)?.hash;
241
- return [origin, pathname, query ? `?${query}` : '', hash].filter(Boolean).join('');
242
- };
243
- const joinSearchParams = (...list) => {
244
- const result = new URLSearchParams();
245
- for (const searchParams of list) {
246
- for (const [k, v] of searchParams) {
247
- result.set(k, v);
248
- }
249
- }
250
- return result;
251
- };
252
- const cleanPath = (pathParts) => pathParts.join('/').replace(/\/+/g, '/');
253
-
254
234
  const isURL = (href) => Boolean(href?.includes(':'));
255
235
  const isLocalURL = (href, target) => Boolean(href && !isURL(href) && (!target || target === '_self'));
256
236
  const isHash = (href) => Boolean(href?.startsWith('#'));
257
237
  const withoutQuery = (href) => (href ?? '').replace(/\?.*/, '').replace(/\/$/, '');
238
+ const joinPath = (...path) => path
239
+ .filter(Boolean)
240
+ .join('/')
241
+ .replace(/\/+/g, '/')
242
+ .replace(/^(.+):\//, '$1://') // TODO Череда очень странных преобрвзований
243
+ .replace(/^file:/, 'file:/')
244
+ .replace(/\/(\?|&|#[^!])/g, '$1')
245
+ .replace(/\?/g, '&')
246
+ .replace('&', '?');
258
247
  const hasPrefix = (href) => (prefix) => Boolean(href &&
259
248
  prefix &&
260
249
  href.startsWith(prefix) &&
@@ -266,8 +255,8 @@
266
255
  isLocalURL: isLocalURL,
267
256
  isHash: isHash,
268
257
  withoutQuery: withoutQuery,
269
- hasPrefix: hasPrefix,
270
- joinPath: joinPath
258
+ joinPath: joinPath,
259
+ hasPrefix: hasPrefix
271
260
  });
272
261
 
273
262
  const API_PREFIX = '/api/';
@@ -5102,17 +5091,21 @@
5102
5091
  const CHAT_STORAGE_NAME = 'webchat-keep-open';
5103
5092
  const CHATBOT_URL = {
5104
5093
  personal: '//chat.mes.rshb.ru/assets/js/webchat_rshb',
5105
- business: '', //TODO: add url business chat
5094
+ business: '/webchat',
5106
5095
  };
5107
5096
  const useChatBot = (chat) => {
5108
5097
  useEffect(() => globalThis.localStorage?.setItem(CHAT_STORAGE_NAME, String(Date.now())), []);
5109
5098
  const chatUrl = CHATBOT_URL[chat ?? ''];
5110
- return (ev) => {
5099
+ return async (ev) => {
5111
5100
  if (!chatUrl) {
5112
5101
  return;
5113
5102
  }
5114
5103
  if (chat !== 'personal') {
5115
- initializeExternalNS(CHAT_NAMESPACE, chatUrl);
5104
+ initializeExternalNS(`${CHAT_NAMESPACE}_business_css`, `${chatUrl}/bundle.css`);
5105
+ const businessChat = (await initializeExternalNS(CHAT_NAMESPACE, `${chatUrl}/bundle.js`));
5106
+ if (businessChat?.render) {
5107
+ businessChat.render(CHAT_FRAME_ID, true);
5108
+ }
5116
5109
  }
5117
5110
  else {
5118
5111
  const target = ev.target;
@@ -7009,7 +7002,7 @@
7009
7002
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
7010
7003
  });
7011
7004
 
7012
- const packageVersion = "0.14.769";
7005
+ const packageVersion = "0.14.771";
7013
7006
 
7014
7007
  exports.Blocks = Blocks;
7015
7008
  exports.ContentPage = ContentPage;