{"version":3,"file":"Botpress.CtPtrDJF.mjs","names":[],"sources":["https:/framerusercontent.com/modules/YB7en4AzRVpQHAQW2ste/nOX2rbdGj6yzU6V4oUvI/MessageOverlayService.js","https:/framerusercontent.com/modules/uNMAJJ5pXaRDfnh3YflC/dPTAkvkMywxFDm3y8InS/Botpress.js"],"sourcesContent":["// MessageOverlayService.ts\nfunction _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}export class MessageOverlayService{static getInstance(){if(!MessageOverlayService.instance){MessageOverlayService.instance=new MessageOverlayService;}return MessageOverlayService.instance;}/**\n     * Muss nach dem Event 'webchat:ready' aufgerufen werden.\n     * Dank Guard-Flag bleibt die Methode beim 2. Aufruf ein No-Op.\n     */init(){if(this.initialized)return;this.initialized=true;this.waitForBubble().then(bubble=>{this.createContainer(bubble);this.showDefaultMessage();this.bindChatEvents();this.bindCustomEvents();});}waitForBubble(){return new Promise(resolve=>{const interval=window.setInterval(()=>{const bubble=document.querySelector(\"iframe.bpFab\");if(bubble){clearInterval(interval);resolve(bubble);}},100);});}createContainer(bubble){// Falls der Container schon existiert (aus unerwartetem Grund), abbrechen\nif(this.container)return;const rect=bubble.getBoundingClientRect();this.container=document.createElement(\"div\");this.container.classList.add(\"botpress-overlay-container\");Object.assign(this.container.style,{position:\"fixed\",top:`${rect.top+16}px`,left:`${rect.left-200}px`,display:\"flex\",flexDirection:\"column\",gap:\"8px\",zIndex:\"99999\"});document.body.appendChild(this.container);const customPayload={test:\"test\"};// window.botpress.sendEvent(customPayload)\n}showDefaultMessage(){this.addMessage(\"Sprechen Sie mit uns\",true);}bindChatEvents(){window.botpress.on(\"webchat:opened\",()=>{this.isChatOpen=true;this.hideAll();});/*\n        window.botpress.on(\"webchat:closed\", () => {\n            this.isChatOpen = false\n            this.showAll()\n        })\n        */}bindCustomEvents(){window.botpress.on(\"customEvent\",event=>{console.log(\"Custom event triggered: \",event);const payload=event.payload;// Wenn payload selbst schon ein Array von Nachrichten-Objekten ist\nif(Array.isArray(payload)){payload.forEach(item=>{if(item.msg){this.addMessage(item.msg);}});}else if(payload&&typeof payload.msg===\"string\"){this.addMessage(payload.msg);}});}addMessage(text,isDefault=false){if(!this.container)return;const msgDiv=document.createElement(\"div\");msgDiv.classList.add(\"botpress-message\");if(isDefault)msgDiv.classList.add(\"default\");const span=document.createElement(\"span\");span.classList.add(\"botpress-message-text\");span.innerText=text;msgDiv.appendChild(span);const icon=document.createElement(\"i\");icon.classList.add(\"ph\",\"ph-arrow-right\");msgDiv.appendChild(icon);msgDiv.addEventListener(\"click\",()=>{window.botpress.send(\"webchat:open\");});this.container.appendChild(msgDiv);}hideAll(){if(!this.container)return;this.container.style.display=\"none\";this.container.classList.add(\"hidden\");}showAll(){if(!this.container)return;this.container.classList.remove(\"hidden\");this.container.style.display=\"flex\";}constructor(){_define_property(this,\"container\",null);_define_property(this,\"isChatOpen\",false);_define_property(this,\"initialized\",false// Guard-Flag – init() nur einmal wirksam\n);}}_define_property(MessageOverlayService,\"instance\",void 0);\nexport const __FramerMetadata__ = {\"exports\":{\"MessageOverlayService\":{\"type\":\"class\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MessageOverlayService.map","// Import necessary Framer packages\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{ControlType}from\"framer\";//import { MessageOverlayService } from \"./MessageOverlayService.ts\"\nimport{MessageOverlayService}from\"https://framerusercontent.com/modules/YB7en4AzRVpQHAQW2ste/nOX2rbdGj6yzU6V4oUvI/MessageOverlayService.js\";// Funktion anpassen\nconst injectScript=(src,defer=false)=>{const script=document.createElement(\"script\");script.src=src;script.defer=defer;script.async=true;document.body.appendChild(script);return script// <- hier zurückgeben!\n;};// Define the BotpressEmbed component\nexport function Botpress({botId,clientId,company,companyId}){useEffect(()=>{const coreScript=injectScript(\"https://cdn.botpress.cloud/webchat/v3.0/inject.js\");coreScript.onload=()=>{window.botpress.init({botId:botId,clientId:clientId,// container: \"#bp-webchat\",\n// userId: \"meinEigenerUser123\", // deine eigene ID\nuser:{data:{company:company,companyId:companyId}},configuration:{version:\"v1\",botName:\"Amara von Zeitgewinn\",botAvatar:\"https://files.bpcontent.cloud/2025/06/20/17/20250620174128-5FA9HK31.png\",botDescription:\"Wir bauen schlaue Software-Assistenten, die still im Hintergrund wirken.\",website:{title:\"https://www.zeitgewinn.ai\",link:\"https://www.zeitgewinn.ai\"},email:{title:\"hello@zeitgewinn.ai\",link:\"hello@zeitgewinn.ai\"},phone:{title:\"089 567890\",link:\"089 567890\"},termsOfService:{title:\"Terms of service\",link:\"https://datenschutz.zeitgewinn.ai\"},privacyPolicy:{title:\"Privacy policy\",link:\"https://datenschutz.zeitgewinn.ai\"},color:\"#364F54\",variant:\"solid\",headerVariant:\"solid\",themeMode:\"light\",fontFamily:\"inter\",radius:.5,feedbackEnabled:false,footer:\"[Powered\\xa1 by Botpress](https://botpress.com/?from=webchat)\"}});MessageOverlayService.getInstance().init();// Overlay-Service starten, sobald Webchat bereit ist\n/*\n            window.botpress?.on(\"webchat:ready\", () => {\n                console.log(\"init bubbles\")\n                MessageOverlayService.getInstance().init()\n            })\n            */};// Clean up scripts on unmount\nreturn()=>{coreScript.remove();window.botpress=null;};},[]);// Return a styled container for the Botpress web chat\nreturn /*#__PURE__*/_jsx(\"div\",{style:{height:\"600px\",width:\"100%\",position:\"relative\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"div\",{id:\"bp-webchat\",style:{height:\"100%\",width:\"100%\",position:\"absolute\",top:0,left:0}})});}// Hier definierst du die Properties, die in Framer editierbar sind\nBotpress.defaultProps={botId:\"f47b1ac5-6587-401c-86ed-5972b711c890\",clientId:\"07521452-f6e8-4c7c-a8c5-9ef5d54a7e95\",company:\"Zeitgewinn\",companyId:\"zeitgewinn-001\"};Botpress.propertyControls={botId:{type:ControlType.String,title:\"Bot ID\"},clientId:{type:ControlType.String,title:\"Client ID\"},company:{type:ControlType.String,title:\"Firma\"},companyId:{type:ControlType.String,title:\"Firma ID\"}};\nexport const __FramerMetadata__ = {\"exports\":{\"Botpress\":{\"type\":\"reactComponent\",\"name\":\"Botpress\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Botpress.map"],"mappings":"iRACA,SAAS,EAAiB,EAAI,EAAI,EAAM,CAAmI,OAA/H,KAAO,EAAK,OAAO,eAAe,EAAI,EAAI,CAAO,QAAM,WAAW,GAAK,aAAa,GAAK,SAAS,GAAK,CAAC,CAAO,EAAI,GAAK,EAAc,sBAAkB,EAAb,MAAa,CAAqB,CAAC,OAAO,aAAa,CAA+F,MAA9F,CAAoC,EAAsB,WAAS,IAAI,EAA8B,EAAsB,SAGnW,MAAM,CAAI,KAAK,cAAmB,KAAK,YAAY,GAAK,KAAK,eAAe,CAAC,KAAK,GAAQ,CAAC,KAAK,gBAAgB,EAAO,CAAC,KAAK,oBAAoB,CAAC,KAAK,gBAAgB,CAAC,KAAK,kBAAkB,EAAG,EAAE,eAAe,CAAC,OAAO,IAAI,QAAQ,GAAS,CAAC,IAAM,EAAS,EAAO,gBAAgB,CAAC,IAAM,EAAO,SAAS,cAAc,eAAe,CAAI,IAAQ,cAAc,EAAS,CAAC,EAAQ,EAAO,GAAI,IAAI,EAAG,CAAE,gBAAgB,EAAO,CACza,GAAG,KAAK,UAAU,OAAO,IAAM,EAAK,EAAO,uBAAuB,CAAC,KAAK,UAAU,SAAS,cAAc,MAAM,CAAC,KAAK,UAAU,UAAU,IAAI,6BAA6B,CAAC,OAAO,OAAO,KAAK,UAAU,MAAM,CAAC,SAAS,QAAQ,IAAI,GAAG,EAAK,IAAI,GAAG,IAAI,KAAK,GAAG,EAAK,KAAK,IAAI,IAAI,QAAQ,OAAO,cAAc,SAAS,IAAI,MAAM,OAAO,QAAQ,CAAC,CAAC,SA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