hiko-social-login-react
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

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:

Dependencies (0)

    Dev Dependencies (12)

    Package Sidebar

    Install

    npm i hiko-social-login-react

    Weekly Downloads

    11

    Version

    1.3.1

    License

    ISC

    Unpacked Size

    42.9 kB

    Total Files

    22

    Last publish

    Collaborators

    • jackcylin