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:

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.3.1
    10
    • latest

Version History

Package Sidebar

Install

npm i hiko-social-login-react

Weekly Downloads

16

Version

1.3.1

License

ISC

Unpacked Size

42.9 kB

Total Files

22

Last publish

Collaborators

  • jackcylin