isometrik-plugin-chat-sdk 2.0.7 → 2.0.9

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 (76) hide show
  1. package/dist/cjs/attachment-preview_22.cjs.entry.js +46 -15
  2. package/dist/cjs/attachment-preview_22.cjs.entry.js.map +1 -1
  3. package/dist/cjs/login-page_3.cjs.entry.js +17 -2
  4. package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
  5. package/dist/cjs/member-add.cjs.entry.js +1 -1
  6. package/dist/cjs/reaction-container.cjs.entry.js +1 -1
  7. package/dist/cjs/toast-75ef0607.js +159 -0
  8. package/dist/cjs/toast-75ef0607.js.map +1 -0
  9. package/dist/cjs/toast-notification.cjs.entry.js +21 -15
  10. package/dist/cjs/toast-notification.cjs.entry.js.map +1 -1
  11. package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js +21 -3
  12. package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js.map +1 -1
  13. package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js +14 -11
  14. package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js.map +1 -1
  15. package/dist/collection/components/ChatUIComponent/shared/contact-info/contact-info.js +10 -1
  16. package/dist/collection/components/ChatUIComponent/shared/contact-info/contact-info.js.map +1 -1
  17. package/dist/collection/components/ChatUIComponent/shared/toast-notification/toast-notification.js +32 -26
  18. package/dist/collection/components/ChatUIComponent/shared/toast-notification/toast-notification.js.map +1 -1
  19. package/dist/collection/components/my-component/web-chat/mqtt-host.js +16 -1
  20. package/dist/collection/components/my-component/web-chat/mqtt-host.js.map +1 -1
  21. package/dist/collection/lib/friendly-toast-message.js +38 -0
  22. package/dist/collection/lib/friendly-toast-message.js.map +1 -0
  23. package/dist/collection/lib/toast.js +76 -21
  24. package/dist/collection/lib/toast.js.map +1 -1
  25. package/dist/components/WebChat.js +16 -1
  26. package/dist/components/WebChat.js.map +1 -1
  27. package/dist/components/WebChatBody.js +14 -11
  28. package/dist/components/WebChatBody.js.map +1 -1
  29. package/dist/components/WebChatHeader.js +21 -3
  30. package/dist/components/WebChatHeader.js.map +1 -1
  31. package/dist/components/contact-info2.js +11 -1
  32. package/dist/components/contact-info2.js.map +1 -1
  33. package/dist/components/toast-notification.js +21 -15
  34. package/dist/components/toast-notification.js.map +1 -1
  35. package/dist/components/toast.js +112 -21
  36. package/dist/components/toast.js.map +1 -1
  37. package/dist/esm/attachment-preview_22.entry.js +47 -16
  38. package/dist/esm/attachment-preview_22.entry.js.map +1 -1
  39. package/dist/esm/login-page_3.entry.js +17 -2
  40. package/dist/esm/login-page_3.entry.js.map +1 -1
  41. package/dist/esm/member-add.entry.js +1 -1
  42. package/dist/esm/reaction-container.entry.js +1 -1
  43. package/dist/esm/toast-45ac7913.js +157 -0
  44. package/dist/esm/toast-45ac7913.js.map +1 -0
  45. package/dist/esm/toast-notification.entry.js +21 -15
  46. package/dist/esm/toast-notification.entry.js.map +1 -1
  47. package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
  48. package/dist/isometrik-webchat/p-0c06a021.js +2 -0
  49. package/dist/isometrik-webchat/p-0c06a021.js.map +1 -0
  50. package/dist/isometrik-webchat/{p-76341adb.entry.js → p-6024bf2a.entry.js} +2 -2
  51. package/dist/isometrik-webchat/p-63ff4eea.entry.js +2 -0
  52. package/dist/isometrik-webchat/p-63ff4eea.entry.js.map +1 -0
  53. package/dist/isometrik-webchat/p-9f036163.entry.js +2 -0
  54. package/dist/isometrik-webchat/p-9f036163.entry.js.map +1 -0
  55. package/dist/isometrik-webchat/{p-2195b0c0.entry.js → p-ba6de4e2.entry.js} +2 -2
  56. package/dist/isometrik-webchat/p-d6fd2dd7.entry.js +2 -0
  57. package/dist/isometrik-webchat/p-d6fd2dd7.entry.js.map +1 -0
  58. package/dist/types/components/ChatUIComponent/Header/WebChatHeader.d.ts +1 -0
  59. package/dist/types/components/ChatUIComponent/shared/contact-info/contact-info.d.ts +1 -0
  60. package/dist/types/lib/friendly-toast-message.d.ts +5 -0
  61. package/dist/types/lib/toast.d.ts +1 -0
  62. package/package.json +1 -1
  63. package/dist/cjs/toast-f810e550.js +0 -68
  64. package/dist/cjs/toast-f810e550.js.map +0 -1
  65. package/dist/esm/toast-533dd183.js +0 -66
  66. package/dist/esm/toast-533dd183.js.map +0 -1
  67. package/dist/isometrik-webchat/p-4cb54460.js +0 -2
  68. package/dist/isometrik-webchat/p-4cb54460.js.map +0 -1
  69. package/dist/isometrik-webchat/p-84424caa.entry.js +0 -2
  70. package/dist/isometrik-webchat/p-84424caa.entry.js.map +0 -1
  71. package/dist/isometrik-webchat/p-e1d632b0.entry.js +0 -2
  72. package/dist/isometrik-webchat/p-e1d632b0.entry.js.map +0 -1
  73. package/dist/isometrik-webchat/p-ff023d39.entry.js +0 -2
  74. package/dist/isometrik-webchat/p-ff023d39.entry.js.map +0 -1
  75. /package/dist/isometrik-webchat/{p-76341adb.entry.js.map → p-6024bf2a.entry.js.map} +0 -0
  76. /package/dist/isometrik-webchat/{p-2195b0c0.entry.js.map → p-ba6de4e2.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{r as t,a as i,h as a}from"./p-17a96a2a.js";import{g as o}from"./p-1dc52239.js";import{s as r}from"./p-4cb54460.js";import"./p-8f17345f.js";import"./p-b1330793.js";const e=class{constructor(a){t(this,a);this.reactionRemoved=i(this,"reaction-removed",7);this.messageId=undefined;this.reactionUsers=[];this.userMetaData=undefined;this.reactions=[];this.selectedEmojiId=undefined}async componentWillLoad(){var t;const i=new URLSearchParams(window.location.search);this.conversationId=i.get("conversation");if(this.reactions&&this.reactions.length>0){const i=(t=this.reactions[0])===null||t===void 0?void 0:t.emojiId;this.selectedEmojiId=i;await this.handleReactionTabClick(i)}}async handleReactionTabClick(t){this.selectedEmojiId=t;try{const i=await o(this.conversationId,this.messageId,t);this.reactionUsers=(i===null||i===void 0?void 0:i.reactions)||[]}catch(t){r({message:"Error while getting reaction",type:"error",duration:3e3,position:"bottom-left"})}}render(){var t;const i=(this.reactions||[]).map((t=>Object.assign(Object.assign({},t),{messageId:Array.isArray(t.messageId)?t.messageId[0]:t.messageId})));return a("div",{key:"2c70b85e5fb6fe181c075c901bc3c6f4f87e6b3f",class:"reactions-container",style:{backgroundColor:"var(--bg-secondary-color)",borderRadius:"10px",color:"var(--text-primary-color)",fontSize:"20px"}},a("div",{key:"6cf59f5e7f6776deeb4719c3211bd3557c906be9",class:"reactions-tab-container"},i.map((t=>a("button",{type:"button",class:`emoji-tab ${this.selectedEmojiId===t.emojiId?"selected":""}`,onClick:()=>this.handleReactionTabClick(t.emojiId)},t.src||t.emojiId)))),a("div",{key:"1ec124221879f1102d5df29d09e6a4013fd7b603",class:"reactions-list-container"},this.selectedEmojiId&&((t=this.reactionUsers)===null||t===void 0?void 0:t.length)>0?this.reactionUsers.map((t=>{var i;return a("div",{class:"user-row"},t.userProfileImageUrl?a("img",{class:"avatar",src:t.userProfileImageUrl,alt:""}):a("div",{class:"avatar"}),a("span",{style:{fontSize:"14px"}},t.userId===((i=this.userMetaData)===null||i===void 0?void 0:i.userId)?"You":t.userName))})):a("div",{class:"hint"},"Tap on any tab to see list")))}};e.style=":host { display: block; }\n .reactions-container {\n display: flex; flex-direction: column; padding: 10px;\n box-shadow: 2px 2px 2px var(--bg-senary-color), -2px -2px 2px var(--bg-senary-color);\n }\n .reactions-list-container { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }\n .reactions-tab-container { display: flex; gap: 8px; padding: 0; flex-wrap: wrap; }\n .emoji-tab {\n cursor: pointer; padding: 4px 8px; background: transparent;\n border: none; border-bottom: 1px solid var(--text-primary-color); color: inherit; font-size: inherit;\n }\n .emoji-tab:hover, .emoji-tab.selected { background: var(--bg-tertiary-color); }\n .user-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }\n .avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--bg-primary-light); }\n .hint { font-size: 14px; padding: 10px; opacity: 0.7; }";export{e as reaction_container};
2
- //# sourceMappingURL=p-2195b0c0.entry.js.map
1
+ import{r as t,a as i,h as a}from"./p-17a96a2a.js";import{g as o}from"./p-1dc52239.js";import{s as r}from"./p-0c06a021.js";import"./p-8f17345f.js";import"./p-b1330793.js";const e=class{constructor(a){t(this,a);this.reactionRemoved=i(this,"reaction-removed",7);this.messageId=undefined;this.reactionUsers=[];this.userMetaData=undefined;this.reactions=[];this.selectedEmojiId=undefined}async componentWillLoad(){var t;const i=new URLSearchParams(window.location.search);this.conversationId=i.get("conversation");if(this.reactions&&this.reactions.length>0){const i=(t=this.reactions[0])===null||t===void 0?void 0:t.emojiId;this.selectedEmojiId=i;await this.handleReactionTabClick(i)}}async handleReactionTabClick(t){this.selectedEmojiId=t;try{const i=await o(this.conversationId,this.messageId,t);this.reactionUsers=(i===null||i===void 0?void 0:i.reactions)||[]}catch(t){r({message:"Error while getting reaction",type:"error",duration:3e3,position:"bottom-left"})}}render(){var t;const i=(this.reactions||[]).map((t=>Object.assign(Object.assign({},t),{messageId:Array.isArray(t.messageId)?t.messageId[0]:t.messageId})));return a("div",{key:"2c70b85e5fb6fe181c075c901bc3c6f4f87e6b3f",class:"reactions-container",style:{backgroundColor:"var(--bg-secondary-color)",borderRadius:"10px",color:"var(--text-primary-color)",fontSize:"20px"}},a("div",{key:"6cf59f5e7f6776deeb4719c3211bd3557c906be9",class:"reactions-tab-container"},i.map((t=>a("button",{type:"button",class:`emoji-tab ${this.selectedEmojiId===t.emojiId?"selected":""}`,onClick:()=>this.handleReactionTabClick(t.emojiId)},t.src||t.emojiId)))),a("div",{key:"1ec124221879f1102d5df29d09e6a4013fd7b603",class:"reactions-list-container"},this.selectedEmojiId&&((t=this.reactionUsers)===null||t===void 0?void 0:t.length)>0?this.reactionUsers.map((t=>{var i;return a("div",{class:"user-row"},t.userProfileImageUrl?a("img",{class:"avatar",src:t.userProfileImageUrl,alt:""}):a("div",{class:"avatar"}),a("span",{style:{fontSize:"14px"}},t.userId===((i=this.userMetaData)===null||i===void 0?void 0:i.userId)?"You":t.userName))})):a("div",{class:"hint"},"Tap on any tab to see list")))}};e.style=":host { display: block; }\n .reactions-container {\n display: flex; flex-direction: column; padding: 10px;\n box-shadow: 2px 2px 2px var(--bg-senary-color), -2px -2px 2px var(--bg-senary-color);\n }\n .reactions-list-container { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }\n .reactions-tab-container { display: flex; gap: 8px; padding: 0; flex-wrap: wrap; }\n .emoji-tab {\n cursor: pointer; padding: 4px 8px; background: transparent;\n border: none; border-bottom: 1px solid var(--text-primary-color); color: inherit; font-size: inherit;\n }\n .emoji-tab:hover, .emoji-tab.selected { background: var(--bg-tertiary-color); }\n .user-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }\n .avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--bg-primary-light); }\n .hint { font-size: 14px; padding: 10px; opacity: 0.7; }";export{e as reaction_container};
2
+ //# sourceMappingURL=p-ba6de4e2.entry.js.map
@@ -0,0 +1,2 @@
1
+ import{r as s,h as t}from"./p-17a96a2a.js";const e=class{constructor(t){s(this,t);this.bgColor="#18181b";this.width="200px";this.height="auto";this.borderWidth="0";this.borderColor="transparent";this.color="#ffffff";this.fontSize="0.875rem";this.borderRadius="0.5rem";this.fontWeight="600";this.progressBarBg="transparent";this.progressBarHeight="3px";this.progressBarColor="rgba(255,255,255,0.55)";this.progressBarBorderRadius="0";this.toastMessage="Default message";this.padding=undefined}render(){const s=this.borderWidth||"0";const e=this.borderColor||"transparent";return t("div",{key:"26860c462525339767af80e40eb7f81cbd2100fb",class:"toast-container",role:"status",style:{backgroundColor:this.bgColor,color:this.color,width:this.width,height:this.height,border:s==="0"||s==="0px"?"none":`${s} solid ${e}`,borderRadius:this.borderRadius,fontSize:this.fontSize,fontWeight:this.fontWeight}},t("div",{key:"894c28f99edda42212508bd4035b99bd125d1681",class:"toast-message",style:{padding:this.padding}},this.toastMessage),t("div",{key:"a40e5a0d3e8746efedbd175a555deb4a2fdaea1b",class:"progress-container",style:{height:this.progressBarHeight,borderRadius:this.progressBarBorderRadius,background:this.progressBarBg}},t("div",{key:"f3248675f982049e927d41bb6c899050695f02e4",class:"progress-bar",style:{backgroundColor:this.progressBarColor}})))}};e.style=":host { display: block; }\n .toast-container {\n overflow: hidden;\n box-shadow: 0 8px 24px rgba(24, 24, 27, 0.18);\n letter-spacing: -0.01em;\n line-height: 1.35;\n }\n .toast-message { padding: 8px; word-break: break-word; }\n .progress-container { width: 100%; overflow: hidden; position: relative; }\n .progress-bar {\n height: 100%; width: 100%; transform-origin: left;\n animation: progress 3.5s linear forwards;\n }\n @keyframes progress {\n from { width: 100%; }\n to { width: 0%; }\n }";export{e as toast_notification};
2
+ //# sourceMappingURL=p-d6fd2dd7.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ToastNotification","render","borderW","this","borderWidth","borderC","borderColor","h","key","class","role","style","backgroundColor","bgColor","color","width","height","border","borderRadius","fontSize","fontWeight","padding","toastMessage","progressBarHeight","progressBarBorderRadius","background","progressBarBg","progressBarColor"],"sources":["src/components/ChatUIComponent/shared/toast-notification/toast-notification.tsx"],"sourcesContent":["import { Component, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'toast-notification',\n shadow: true,\n styles: `\n :host { display: block; }\n .toast-container {\n overflow: hidden;\n box-shadow: 0 8px 24px rgba(24, 24, 27, 0.18);\n letter-spacing: -0.01em;\n line-height: 1.35;\n }\n .toast-message { padding: 8px; word-break: break-word; }\n .progress-container { width: 100%; overflow: hidden; position: relative; }\n .progress-bar {\n height: 100%; width: 100%; transform-origin: left;\n animation: progress 3.5s linear forwards;\n }\n @keyframes progress {\n from { width: 100%; }\n to { width: 0%; }\n }\n `,\n})\nexport class ToastNotification {\n @Prop() bgColor: string = '#18181b';\n @Prop() width: string = '200px';\n @Prop() height: string = 'auto';\n @Prop() borderWidth: string = '0';\n @Prop() borderColor: string = 'transparent';\n @Prop() color: string = '#ffffff';\n @Prop() fontSize: string = '0.875rem';\n @Prop() borderRadius: string = '0.5rem';\n @Prop() fontWeight: string = '600';\n @Prop() progressBarBg: string = 'transparent';\n @Prop() progressBarHeight: string = '3px';\n @Prop() progressBarColor: string = 'rgba(255,255,255,0.55)';\n @Prop() progressBarBorderRadius: string = '0';\n @Prop() toastMessage: string = 'Default message';\n @Prop() padding: string;\n\n render() {\n const borderW = this.borderWidth || '0';\n const borderC = this.borderColor || 'transparent';\n return (\n <div\n class=\"toast-container\"\n role=\"status\"\n style={{\n backgroundColor: this.bgColor,\n color: this.color,\n width: this.width,\n height: this.height,\n border: borderW === '0' || borderW === '0px' ? 'none' : `${borderW} solid ${borderC}`,\n borderRadius: this.borderRadius,\n fontSize: this.fontSize,\n fontWeight: this.fontWeight,\n }}\n >\n <div class=\"toast-message\" style={{ padding: this.padding }}>\n {this.toastMessage}\n </div>\n <div\n class=\"progress-container\"\n style={{\n height: this.progressBarHeight,\n borderRadius: this.progressBarBorderRadius,\n background: this.progressBarBg,\n }}\n >\n <div class=\"progress-bar\" style={{ backgroundColor: this.progressBarColor }} />\n </div>\n </div>\n );\n }\n}\n"],"mappings":"iDAyBaA,EAAiB,M,sCACF,U,WACF,Q,YACC,O,iBACK,I,iBACA,c,WACN,U,cACG,W,kBACI,S,gBACF,M,mBACG,c,uBACI,M,sBACD,yB,6BACO,I,kBACX,kB,uBAG/B,MAAAC,GACE,MAAMC,EAAUC,KAAKC,aAAe,IACpC,MAAMC,EAAUF,KAAKG,aAAe,cACpC,OACEC,EAAA,OAAAC,IAAA,2CACEC,MAAM,kBACNC,KAAK,SACLC,MAAO,CACLC,gBAAiBT,KAAKU,QACtBC,MAAOX,KAAKW,MACZC,MAAOZ,KAAKY,MACZC,OAAQb,KAAKa,OACbC,OAAQf,IAAY,KAAOA,IAAY,MAAQ,OAAS,GAAGA,WAAiBG,IAC5Ea,aAAcf,KAAKe,aACnBC,SAAUhB,KAAKgB,SACfC,WAAYjB,KAAKiB,aAGnBb,EAAA,OAAAC,IAAA,2CAAKC,MAAM,gBAAgBE,MAAO,CAAEU,QAASlB,KAAKkB,UAC/ClB,KAAKmB,cAERf,EAAA,OAAAC,IAAA,2CACEC,MAAM,qBACNE,MAAO,CACLK,OAAQb,KAAKoB,kBACbL,aAAcf,KAAKqB,wBACnBC,WAAYtB,KAAKuB,gBAGnBnB,EAAA,OAAAC,IAAA,2CAAKC,MAAM,eAAeE,MAAO,CAAEC,gBAAiBT,KAAKwB,qB","ignoreList":[]}
@@ -40,6 +40,7 @@ declare class WebChatHeader {
40
40
  handleConversationDetailsChange(newValue: ConversationDetails): void;
41
41
  handleDocumentClick(e: MouseEvent): void;
42
42
  handleClearChat: () => Promise<void>;
43
+ private deleteChat;
43
44
  handleSearchInput: (searchText: string) => void;
44
45
  handleSearchResultClick: (messageId: string) => Promise<void>;
45
46
  handleTextClick: () => void;
@@ -70,6 +70,7 @@ export declare class ContactInfo {
70
70
  private close;
71
71
  private emitAction;
72
72
  private confirmClearChat;
73
+ private confirmDeleteChat;
73
74
  private confirmExitGroup;
74
75
  private openAddMember;
75
76
  private isSelfAdmin;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Map raw API / SDK errors to short user-facing copy.
3
+ * Never surface HTTP status phrases like "Unprocessable entity".
4
+ */
5
+ export declare function friendlyToastMessage(raw: unknown, fallback?: string): string;
@@ -1,4 +1,5 @@
1
1
  import '../components/ChatUIComponent/shared/toast-notification/toast-notification';
2
+ export { friendlyToastMessage } from './friendly-toast-message';
2
3
  export interface ToastOptions {
3
4
  message: string;
4
5
  duration?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isometrik-plugin-chat-sdk",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "Isometrik WebChat SDK — embeddable real-time chat web components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1,68 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-66f98408.js');
4
-
5
- class ToastHelper {
6
- constructor() {
7
- this.container = document.createElement('div');
8
- this.container.style.position = 'fixed';
9
- this.container.style.zIndex = '9999';
10
- document.body.appendChild(this.container);
11
- }
12
- static getInstance() {
13
- if (!ToastHelper.instance)
14
- ToastHelper.instance = new ToastHelper();
15
- return ToastHelper.instance;
16
- }
17
- getTypeStyles(type = 'info') {
18
- const styles = {
19
- success: { bgColor: 'var(--success)', progressBarColor: 'var(--bg-primary)' },
20
- error: { bgColor: 'var(--danger)', progressBarColor: '#da190b' },
21
- warning: { bgColor: 'var(--text-warning-color, #cf6f0f)', progressBarColor: '#e68900' },
22
- info: { bgColor: 'var(--text-info-color, #a5a2a2)', progressBarColor: '#0b7dda' },
23
- };
24
- return styles[type] || styles.info;
25
- }
26
- setPosition(position = 'top-right') {
27
- const positions = {
28
- 'top-right': { top: '20px', right: '20px', bottom: 'auto', left: 'auto' },
29
- 'top-left': { top: '20px', right: 'auto', bottom: 'auto', left: '20px' },
30
- 'bottom-right': { top: 'auto', right: '20px', bottom: '20px', left: 'auto' },
31
- 'bottom-left': { top: 'auto', right: 'auto', bottom: '20px', left: '20px' },
32
- 'top-center': { top: '20px', right: 'auto', bottom: 'auto', left: '50%', transform: 'translateX(-50%)' },
33
- 'bottom-center': { top: 'auto', right: 'auto', bottom: '20px', left: '50%', transform: 'translateX(-50%)' },
34
- };
35
- Object.assign(this.container.style, positions[position] || positions['top-right']);
36
- }
37
- show(options) {
38
- const { message, duration = 3000, type = 'info', position = 'top-right' } = options;
39
- this.setPosition(position);
40
- const toast = document.createElement('toast-notification');
41
- const styles = this.getTypeStyles(type);
42
- toast.bgColor = styles.bgColor;
43
- toast.color = 'var(--bg-primary)';
44
- toast.progressBarColor = 'var(--bg-primary)';
45
- toast.toastMessage = message;
46
- toast.padding = '12px';
47
- toast.borderRadius = '5px';
48
- toast.width = '300px';
49
- toast.style.marginBottom = '10px';
50
- toast.style.display = 'block';
51
- this.container.appendChild(toast);
52
- setTimeout(() => toast.remove(), duration);
53
- }
54
- }
55
- const showToast = (options) => {
56
- var _a;
57
- const custom = index.createCustomPartElement('toast', options);
58
- if (custom) {
59
- document.body.appendChild(custom);
60
- setTimeout(() => custom.remove(), (_a = options.duration) !== null && _a !== void 0 ? _a : 3000);
61
- return;
62
- }
63
- ToastHelper.getInstance().show(options);
64
- };
65
-
66
- exports.showToast = showToast;
67
-
68
- //# sourceMappingURL=toast-f810e550.js.map
@@ -1 +0,0 @@
1
- {"file":"toast-f810e550.js","mappings":";;;;AAUA,MAAM,WAAW;IAIf;QACE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KAC3C;IAEM,OAAO,WAAW;QACvB,IAAI,CAAC,WAAW,CAAC,QAAQ;YAAE,WAAW,CAAC,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;QACpE,OAAO,WAAW,CAAC,QAAQ,CAAC;KAC7B;IAEO,aAAa,CAAC,OAAe,MAAM;QACzC,MAAM,MAAM,GAAkE;YAC5E,OAAO,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE;YAC7E,KAAK,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,SAAS,EAAE;YAChE,OAAO,EAAE,EAAE,OAAO,EAAE,oCAAoC,EAAE,gBAAgB,EAAE,SAAS,EAAE;YACvF,IAAI,EAAE,EAAE,OAAO,EAAE,iCAAiC,EAAE,gBAAgB,EAAE,SAAS,EAAE;SAClF,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC;KACpC;IAEO,WAAW,CAA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Q,CAAC;QAClE,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACxC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,KAAK,CAAC,KAAK,GAAG,mBAAmB,CAAC;QAClC,KAAK,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;QAC7C,KAAK,CAAC,YAAY,GAAG,OAAO,CAAC;QAC7B,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QACvB,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC;QAC3B,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC;QACtB,KAAK,CAAC,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC;QAClC,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QAC9B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAClC,UAAU,CAAC,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAC;KAC5C;CACF;MAEY,SAAS,GAAG,CAAC,OAAqB;;IAC7C,MAAM,MAAM,GAAGA,6BAAuB,CAAC,OAAO,EAAE,OAAc,CAAC,CAAC;IAChE,IAAI,MAAM,EAAE;QACV,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,UAAU,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,IAAI,CAAC,CAAC;QAC5D,OAAO;KACR;IACD,WAAW,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC1C;;;;","names":["createCustomPartElement"],"sources":["src/lib/toast.ts"],"sourcesContent":["import '../components/ChatUIComponent/shared/toast-notification/toast-notification';\nimport { createCustomPartElement } from './custom-ui';\n\nexport interface ToastOptions {\n message: string;\n duration?: number;\n type?: 'success' | 'error' | 'warning' | 'info';\n position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';\n}\n\nclass ToastHelper {\n private static instance: ToastHelper;\n private container: HTMLDivElement;\n\n private constructor() {\n this.container = document.createElement('div');\n this.container.style.position = 'fixed';\n this.container.style.zIndex = '9999';\n document.body.appendChild(this.container);\n }\n\n public static getInstance(): ToastHelper {\n if (!ToastHelper.instance) ToastHelper.instance = new ToastHelper();\n return ToastHelper.instance;\n }\n\n private getTypeStyles(type: string = 'info') {\n const styles: Record<string, { bgColor: string; progressBarColor: string }> = {\n success: { bgColor: 'var(--success)', progressBarColor: 'var(--bg-primary)' },\n error: { bgColor: 'var(--danger)', progressBarColor: '#da190b' },\n warning: { bgColor: 'var(--text-warning-color, #cf6f0f)', progressBarColor: '#e68900' },\n info: { bgColor: 'var(--text-info-color, #a5a2a2)', progressBarColor: '#0b7dda' },\n };\n return styles[type] || styles.info;\n }\n\n private setPosition(position: string = 'top-right') {\n const positions: Record<string, Partial<CSSStyleDeclaration>> = {\n 'top-right': { top: '20px', right: '20px', bottom: 'auto', left: 'auto' },\n 'top-left': { top: '20px', right: 'auto', bottom: 'auto', left: '20px' },\n 'bottom-right': { top: 'auto', right: '20px', bottom: '20px', left: 'auto' },\n 'bottom-left': { top: 'auto', right: 'auto', bottom: '20px', left: '20px' },\n 'top-center': { top: '20px', right: 'auto', bottom: 'auto', left: '50%', transform: 'translateX(-50%)' },\n 'bottom-center': { top: 'auto', right: 'auto', bottom: '20px', left: '50%', transform: 'translateX(-50%)' },\n };\n Object.assign(this.container.style, positions[position] || positions['top-right']);\n }\n\n public show(options: ToastOptions): void {\n const { message, duration = 3000, type = 'info', position = 'top-right' } = options;\n this.setPosition(position);\n const toast = document.createElement('toast-notification') as any;\n const styles = this.getTypeStyles(type);\n toast.bgColor = styles.bgColor;\n toast.color = 'var(--bg-primary)';\n toast.progressBarColor = 'var(--bg-primary)';\n toast.toastMessage = message;\n toast.padding = '12px';\n toast.borderRadius = '5px';\n toast.width = '300px';\n toast.style.marginBottom = '10px';\n toast.style.display = 'block';\n this.container.appendChild(toast);\n setTimeout(() => toast.remove(), duration);\n }\n}\n\nexport const showToast = (options: ToastOptions): void => {\n const custom = createCustomPartElement('toast', options as any);\n if (custom) {\n document.body.appendChild(custom);\n setTimeout(() => custom.remove(), options.duration ?? 3000);\n return;\n }\n ToastHelper.getInstance().show(options);\n};\n"],"version":3}
@@ -1,66 +0,0 @@
1
- import { c as createCustomPartElement } from './index-4c865e34.js';
2
-
3
- class ToastHelper {
4
- constructor() {
5
- this.container = document.createElement('div');
6
- this.container.style.position = 'fixed';
7
- this.container.style.zIndex = '9999';
8
- document.body.appendChild(this.container);
9
- }
10
- static getInstance() {
11
- if (!ToastHelper.instance)
12
- ToastHelper.instance = new ToastHelper();
13
- return ToastHelper.instance;
14
- }
15
- getTypeStyles(type = 'info') {
16
- const styles = {
17
- success: { bgColor: 'var(--success)', progressBarColor: 'var(--bg-primary)' },
18
- error: { bgColor: 'var(--danger)', progressBarColor: '#da190b' },
19
- warning: { bgColor: 'var(--text-warning-color, #cf6f0f)', progressBarColor: '#e68900' },
20
- info: { bgColor: 'var(--text-info-color, #a5a2a2)', progressBarColor: '#0b7dda' },
21
- };
22
- return styles[type] || styles.info;
23
- }
24
- setPosition(position = 'top-right') {
25
- const positions = {
26
- 'top-right': { top: '20px', right: '20px', bottom: 'auto', left: 'auto' },
27
- 'top-left': { top: '20px', right: 'auto', bottom: 'auto', left: '20px' },
28
- 'bottom-right': { top: 'auto', right: '20px', bottom: '20px', left: 'auto' },
29
- 'bottom-left': { top: 'auto', right: 'auto', bottom: '20px', left: '20px' },
30
- 'top-center': { top: '20px', right: 'auto', bottom: 'auto', left: '50%', transform: 'translateX(-50%)' },
31
- 'bottom-center': { top: 'auto', right: 'auto', bottom: '20px', left: '50%', transform: 'translateX(-50%)' },
32
- };
33
- Object.assign(this.container.style, positions[position] || positions['top-right']);
34
- }
35
- show(options) {
36
- const { message, duration = 3000, type = 'info', position = 'top-right' } = options;
37
- this.setPosition(position);
38
- const toast = document.createElement('toast-notification');
39
- const styles = this.getTypeStyles(type);
40
- toast.bgColor = styles.bgColor;
41
- toast.color = 'var(--bg-primary)';
42
- toast.progressBarColor = 'var(--bg-primary)';
43
- toast.toastMessage = message;
44
- toast.padding = '12px';
45
- toast.borderRadius = '5px';
46
- toast.width = '300px';
47
- toast.style.marginBottom = '10px';
48
- toast.style.display = 'block';
49
- this.container.appendChild(toast);
50
- setTimeout(() => toast.remove(), duration);
51
- }
52
- }
53
- const showToast = (options) => {
54
- var _a;
55
- const custom = createCustomPartElement('toast', options);
56
- if (custom) {
57
- document.body.appendChild(custom);
58
- setTimeout(() => custom.remove(), (_a = options.duration) !== null && _a !== void 0 ? _a : 3000);
59
- return;
60
- }
61
- ToastHelper.getInstance().show(options);
62
- };
63
-
64
- export { showToast as s };
65
-
66
- //# sourceMappingURL=toast-533dd183.js.map
@@ -1 +0,0 @@
1
- {"file":"toast-533dd183.js","mappings":";;AAUA,MAAM,WAAW;IAIf;QACE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KAC3C;IAEM,OAAO,WAAW;QACvB,IAAI,CAAC,WAAW,CAAC,QAAQ;YAAE,WAAW,CAAC,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;QACpE,OAAO,WAAW,CAAC,QAAQ,CAAC;KAC7B;IAEO,aAAa,CAAC,OAAe,MAAM;QACzC,MAAM,MAAM,GAAkE;YAC5E,OAAO,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE;YAC7E,KAAK,EAAE,EAAE,OAAO,EAA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C;QAC5D,OAAO;KACR;IACD,WAAW,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC1C;;;;","names":[],"sources":["src/lib/toast.ts"],"sourcesContent":["import '../components/ChatUIComponent/shared/toast-notification/toast-notification';\nimport { createCustomPartElement } from './custom-ui';\n\nexport interface ToastOptions {\n message: string;\n duration?: number;\n type?: 'success' | 'error' | 'warning' | 'info';\n position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';\n}\n\nclass ToastHelper {\n private static instance: ToastHelper;\n private container: HTMLDivElement;\n\n private constructor() {\n this.container = document.createElement('div');\n this.container.style.position = 'fixed';\n this.container.style.zIndex = '9999';\n document.body.appendChild(this.container);\n }\n\n public static getInstance(): ToastHelper {\n if (!ToastHelper.instance) ToastHelper.instance = new ToastHelper();\n return ToastHelper.instance;\n }\n\n private getTypeStyles(type: string = 'info') {\n const styles: Record<string, { bgColor: string; progressBarColor: string }> = {\n success: { bgColor: 'var(--success)', progressBarColor: 'var(--bg-primary)' },\n error: { bgColor: 'var(--danger)', progressBarColor: '#da190b' },\n warning: { bgColor: 'var(--text-warning-color, #cf6f0f)', progressBarColor: '#e68900' },\n info: { bgColor: 'var(--text-info-color, #a5a2a2)', progressBarColor: '#0b7dda' },\n };\n return styles[type] || styles.info;\n }\n\n private setPosition(position: string = 'top-right') {\n const positions: Record<string, Partial<CSSStyleDeclaration>> = {\n 'top-right': { top: '20px', right: '20px', bottom: 'auto', left: 'auto' },\n 'top-left': { top: '20px', right: 'auto', bottom: 'auto', left: '20px' },\n 'bottom-right': { top: 'auto', right: '20px', bottom: '20px', left: 'auto' },\n 'bottom-left': { top: 'auto', right: 'auto', bottom: '20px', left: '20px' },\n 'top-center': { top: '20px', right: 'auto', bottom: 'auto', left: '50%', transform: 'translateX(-50%)' },\n 'bottom-center': { top: 'auto', right: 'auto', bottom: '20px', left: '50%', transform: 'translateX(-50%)' },\n };\n Object.assign(this.container.style, positions[position] || positions['top-right']);\n }\n\n public show(options: ToastOptions): void {\n const { message, duration = 3000, type = 'info', position = 'top-right' } = options;\n this.setPosition(position);\n const toast = document.createElement('toast-notification') as any;\n const styles = this.getTypeStyles(type);\n toast.bgColor = styles.bgColor;\n toast.color = 'var(--bg-primary)';\n toast.progressBarColor = 'var(--bg-primary)';\n toast.toastMessage = message;\n toast.padding = '12px';\n toast.borderRadius = '5px';\n toast.width = '300px';\n toast.style.marginBottom = '10px';\n toast.style.display = 'block';\n this.container.appendChild(toast);\n setTimeout(() => toast.remove(), duration);\n }\n}\n\nexport const showToast = (options: ToastOptions): void => {\n const custom = createCustomPartElement('toast', options as any);\n if (custom) {\n document.body.appendChild(custom);\n setTimeout(() => custom.remove(), options.duration ?? 3000);\n return;\n }\n ToastHelper.getInstance().show(options);\n};\n"],"version":3}
@@ -1,2 +0,0 @@
1
- import{c as t}from"./p-b1330793.js";class o{constructor(){this.container=document.createElement("div");this.container.style.position="fixed";this.container.style.zIndex="9999";document.body.appendChild(this.container)}static getInstance(){if(!o.instance)o.instance=new o;return o.instance}getTypeStyles(t="info"){const o={success:{bgColor:"var(--success)",progressBarColor:"var(--bg-primary)"},error:{bgColor:"var(--danger)",progressBarColor:"#da190b"},warning:{bgColor:"var(--text-warning-color, #cf6f0f)",progressBarColor:"#e68900"},info:{bgColor:"var(--text-info-color, #a5a2a2)",progressBarColor:"#0b7dda"}};return o[t]||o.info}setPosition(t="top-right"){const o={"top-right":{top:"20px",right:"20px",bottom:"auto",left:"auto"},"top-left":{top:"20px",right:"auto",bottom:"auto",left:"20px"},"bottom-right":{top:"auto",right:"20px",bottom:"20px",left:"auto"},"bottom-left":{top:"auto",right:"auto",bottom:"20px",left:"20px"},"top-center":{top:"20px",right:"auto",bottom:"auto",left:"50%",transform:"translateX(-50%)"},"bottom-center":{top:"auto",right:"auto",bottom:"20px",left:"50%",transform:"translateX(-50%)"}};Object.assign(this.container.style,o[t]||o["top-right"])}show(t){const{message:o,duration:r=3e3,type:s="info",position:a="top-right"}=t;this.setPosition(a);const e=document.createElement("toast-notification");const i=this.getTypeStyles(s);e.bgColor=i.bgColor;e.color="var(--bg-primary)";e.progressBarColor="var(--bg-primary)";e.toastMessage=o;e.padding="12px";e.borderRadius="5px";e.width="300px";e.style.marginBottom="10px";e.style.display="block";this.container.appendChild(e);setTimeout((()=>e.remove()),r)}}const r=r=>{var s;const a=t("toast",r);if(a){document.body.appendChild(a);setTimeout((()=>a.remove()),(s=r.duration)!==null&&s!==void 0?s:3e3);return}o.getInstance().show(r)};export{r as s};
2
- //# sourceMappingURL=p-4cb54460.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ToastHelper","constructor","this","container","document","createElement","style","position","zIndex","body","appendChild","getInstance","instance","getTypeStyles","type","styles","success","bgColor","progressBarColor","error","warning","info","setPosition","positions","top","right","bottom","left","transform","Object","assign","show","options","message","duration","toast","color","toastMessage","padding","borderRadius","width","marginBottom","display","setTimeout","remove","showToast","custom","createCustomPartElement","_a"],"sources":["src/lib/toast.ts"],"sourcesContent":["import '../components/ChatUIComponent/shared/toast-notification/toast-notification';\nimport { createCustomPartElement } from './custom-ui';\n\nexport interface ToastOptions {\n message: string;\n duration?: number;\n type?: 'success' | 'error' | 'warning' | 'info';\n position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';\n}\n\nclass ToastHelper {\n private static instance: ToastHelper;\n private container: HTMLDivElement;\n\n private constructor() {\n this.container = document.createElement('div');\n this.container.style.position = 'fixed';\n this.container.style.zIndex = '9999';\n document.body.appendChild(this.container);\n }\n\n public static getInstance(): ToastHelper {\n if (!ToastHelper.instance) ToastHelper.instance = new ToastHelper();\n return ToastHelper.instance;\n }\n\n private getTypeStyles(type: string = 'info') {\n const styles: Record<string, { bgColor: string; progressBarColor: string }> = {\n success: { bgColor: 'var(--success)', progressBarColor: 'var(--bg-primary)' },\n error: { bgColor: 'var(--danger)', progressBarColor: '#da190b' },\n warning: { bgColor: 'var(--text-warning-color, #cf6f0f)', progressBarColor: '#e68900' },\n info: { bgColor: 'var(--text-info-color, #a5a2a2)', progressBarColor: '#0b7dda' },\n };\n return styles[type] || styles.info;\n }\n\n private setPosition(position: string = 'top-right') {\n const positions: Record<string, Partial<CSSStyleDeclaration>> = {\n 'top-right': { top: '20px', right: '20px', bottom: 'auto', left: 'auto' },\n 'top-left': { top: '20px', right: 'auto', bottom: 'auto', left: '20px' },\n 'bottom-right': { top: 'auto', right: '20px', bottom: '20px', left: 'auto' },\n 'bottom-left': { top: 'auto', right: 'auto', bottom: '20px', left: '20px' },\n 'top-center': { top: '20px', right: 'auto', bottom: 'auto', left: '50%', transform: 'translateX(-50%)' },\n 'bottom-center': { top: 'auto', right: 'auto', bottom: '20px', left: '50%', transform: 'translateX(-50%)' },\n };\n Object.assign(this.container.style, positions[position] || positions['top-right']);\n }\n\n public show(options: ToastOptions): void {\n const { message, duration = 3000, type = 'info', position = 'top-right' } = options;\n this.setPosition(position);\n const toast = document.createElement('toast-notification') as any;\n const styles = this.getTypeStyles(type);\n toast.bgColor = styles.bgColor;\n toast.color = 'var(--bg-primary)';\n toast.progressBarColor = 'var(--bg-primary)';\n toast.toastMessage = message;\n toast.padding = '12px';\n toast.borderRadius = '5px';\n toast.width = '300px';\n toast.style.marginBottom = '10px';\n toast.style.display = 'block';\n this.container.appendChild(toast);\n setTimeout(() => toast.remove(), duration);\n }\n}\n\nexport const showToast = (options: ToastOptions): void => {\n const custom = createCustomPartElement('toast', options as any);\n if (custom) {\n document.body.appendChild(custom);\n setTimeout(() => custom.remove(), options.duration ?? 3000);\n return;\n }\n ToastHelper.getInstance().show(options);\n};\n"],"mappings":"oCAUA,MAAMA,EAIJ,WAAAC,GACEC,KAAKC,UAAYC,SAASC,cAAc,OACxCH,KAAKC,UAAUG,MAAMC,SAAW,QAChCL,KAAKC,UAAUG,MAAME,OAAS,OAC9BJ,SAASK,KAAKC,YAAYR,KAAKC,U,CAG1B,kBAAOQ,GACZ,IAAKX,E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