{"version":3,"file":"MessageToaster.CSMsBT3m.mjs","names":[],"sources":["https:/framerusercontent.com/modules/PXKjjm8mjRZVV1zoKlcV/NNAJylmKNDhVJxLcbuC2/MessageToaster.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import React from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const useStore=createStore({title:\"\",message:\"\",points:\"\",description:\"\",type:\"\"});export function withMessageToastTitle(Component){return props=>{const[store]=useStore();return!store.title?/*#__PURE__*/_jsx(Component,{...props,text:props.text}):/*#__PURE__*/_jsx(Component,{...props,text:store.title});};}export function withMessageToastMessage(Component){return props=>{const[store]=useStore();return!store.message?/*#__PURE__*/_jsx(Component,{...props,text:props.text}):/*#__PURE__*/_jsx(Component,{...props,text:store.message});};}export function withMessageToastPoints(Component){return props=>{const[store]=useStore();return!store.points?/*#__PURE__*/_jsx(Component,{...props,text:props.text}):/*#__PURE__*/_jsx(Component,{...props,text:String(store.points)});};}export function withMessageToastReason(Component){return props=>{const[store]=useStore();return!store.reason?/*#__PURE__*/_jsx(Component,{...props,text:props.text}):/*#__PURE__*/_jsx(Component,{...props,text:store.reason});};}export function withMessageToastDescription(Component){return props=>{const[store]=useStore();return!store.description?/*#__PURE__*/_jsx(Component,{...props,text:props.text}):/*#__PURE__*/_jsx(Component,{...props,text:store.description});};}export function withMessageToastContent(Component){return props=>{const[store,setStore]=useStore();React.useEffect(()=>{// Generic message handler for any type\nconst handleMessage=event=>{const{title,message,points,description,type,reason}=event.detail;setStore({title,message,points,description,type,reason});};// Listen for any message event with pattern: *Message\nconst messageTypes=[\"successMessage\",\"errorMessage\",\"defaultMessage\",\"warningMessage\",\"achievementMessage\",\"points-added\"];// Add listeners for all message types\nmessageTypes.forEach(eventType=>{window.addEventListener(eventType,handleMessage);});return()=>{// Remove all listeners\nmessageTypes.forEach(eventType=>{window.removeEventListener(eventType,handleMessage);});};},[]);return /*#__PURE__*/_jsx(Component,{...props,type:store.type,// Pass the type directly as variant without mapping\nvariant:store.type||props.variant});};}export function withMessageToastRedeem(Component){return props=>{const handleRedeem=()=>{const event=new CustomEvent(\"redeem\");window.dispatchEvent(event);};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleRedeem});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withMessageToastTitle\":{\"type\":\"reactHoc\",\"name\":\"withMessageToastTitle\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMessageToastReason\":{\"type\":\"reactHoc\",\"name\":\"withMessageToastReason\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMessageToastMessage\":{\"type\":\"reactHoc\",\"name\":\"withMessageToastMessage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMessageToastContent\":{\"type\":\"reactHoc\",\"name\":\"withMessageToastContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMessageToastPoints\":{\"type\":\"reactHoc\",\"name\":\"withMessageToastPoints\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMessageToastDescription\":{\"type\":\"reactHoc\",\"name\":\"withMessageToastDescription\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMessageToastRedeem\":{\"type\":\"reactHoc\",\"name\":\"withMessageToastRedeem\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MessageToaster.map"],"mappings":"qRAA4N,SAAgB,EAAsB,EAAU,CAAC,MAAO,CAAA,GAAO,CAAC,GAAK,CAAC,EAAM,CAAC,GAAU,CAAC,OAAO,EAAM,MAA2E,EAAK,EAAU,CAAC,GAAG,EAAM,KAAK,EAAM,KAAM,EAAC,CAAnG,EAAK,EAAU,CAAC,GAAG,EAAM,KAAK,EAAM,IAAK,EAAC,AAA2D,CAAE,UAAgB,EAAwB,EAAU,CAAC,MAAO,CAAA,GAAO,CAAC,GAAK,CAAC,EAAM,CAAC,GAAU,CAAC,OAAO,EAAM,QAA6E,EAAK,EAAU,CAAC,GAAG,EAAM,KA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