1.2.1 • Published 11 months ago

hiko-social-login-react v1.2.1

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

hiko-social-login-react

Installation

$ npm i hiko-social-login-react --save
or
$ yarn add hiko-social-login-react

Sample code

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>);

Note:

1.2.1

11 months ago

1.2.0

11 months ago

1.1.0

11 months ago

1.0.0

11 months ago