const shop = "xxxx.myshopify.com";
const [customer, setCustomer] = useState(window.HIKO?.customer);
const handleCustomEvents = useCallback((event) => {
if (["login", "activate", "multipass"].includes(event.detail.action))
setCustomer(event.detail.customer);
}, []);
useEffect(() => {
document.addEventListener("hiko", handleCustomEvents);
return () => document.removeEventListener("hiko", handleCustomEvents);
}, []);
if (customer)
return (
<ul>
{Object.keys(customer).map((key) => (
<li key={key}>
{key}: {customer[key]}
</li>
))}
</ul>
);
return <SocialLoginWidget shop={shop} publicAccessToken={publicAccessToken}></SocialLoginWidget>;