npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@secomus/uppromote-hydrogen

v0.0.9

Published

UpPromote Shopify App - Hydrogen

Downloads

27

Readme

UpPromote Hydrogen App

Installation

Step 1: Create a new Hydrogen app

You can create a Hydrogen app locally using yarn, npm, or npx.

NOTE: If you've already created a Hydrogen app, you can jump ahead to Step 4

If you want to integrate with an existing React framework, like Next.js or Gatsby, then you can add the @shopify/hydrogen NPM package to your project.

We only support development framework Hydrogen version 2 and above. You can learn how to upgrade to Hydrogen version 2 using this link

  1. Navigate to your working directory.

    cd <directory>
  2. Create your project.

    Create a new Hydrogen project with a default template linked to a demo-store with the following this tutorial:

Step 2: Link your Shopify Storefront

Connect your Hydrogen app to your Shopify storefront by updating the properties in the .env file. You will need to generate a Storefront API access token for your Hydrogen app to communicate with your Shopify store.

Step 3: Start a development server

Create a new local development server to start testing your changes.

  1. Navigate to the root of your project directory:

    cd <directory>
  2. Start the development server

    Start up a new local development server on localhost:

    npm run dev

    The development environment will open at http://localhost:3000.

Step 4: Install Uppromote package

  1. Install Uppromote Package
    npm install @secomus/uppromote-hydrogen
  2. Open root file (root.tsx | root.js) and add Uppromote Component

<html lang={locale.language}>
<head>
	...
</head>
<body>
...
<Await resolve={data.cart}>
	{(cart) => (
		<Uppromote
			cart={data.cart}
			publicStoreDomain={env.PUBLIC_STORE_DOMAIN}
			publicStorefrontApiToken={env.PUBLIC_STORE_FRONT_API_TOKEN}
			publicStorefrontApiVersion={env.PUBLIC_STOREFRONT_API_VERSION}
		/>
	)}
</Await>
</body>
</html>
  • Fill your token information to Uppromote component. You need to provide Cart for the app to work. Read the documentation to know how to fetch the Cart

Step 6: Add a content security policy

In your app/entry.server.tsx / app/entry.server.js file add our API endpoint to your list


const {nonce, header, NonceProvider} = createContentSecurityPolicy({
	connectSrc: [
		'https://track.uppromote.com',
		'https://cdn.uppromote.com',
		'https://d1639lhkj5l89m.cloudfront.net',
		...
	],
	defaultSrc: [
		'https://shopify.com',
		'https://track.uppromote.com',
		'https://cdn.uppromote.com',
		'https://d1639lhkj5l89m.cloudfront.net',
		...
	],
	styleSrc: ['https://d1639lhkj5l89m.cloudfront.net', ...],
})

If createContentSecurityPolicy does not exist on your Hydrogen app, follow this shopify docs for adding a content security policy.

API & Events

We provide you with several APIs to help develop your store

  1. Trigger when affiliate has been tracked

    window.addEventListener('uppromote:tracked-affiliate', function (event) {
        console.log(event.detail)
    })
  2. Trigger when facebook pixel code has been initialized

    window.addEventListener('uppromote:pull-fb-pixel', function (event) {
        const { affiliateId, pixel } = event.detail
    })

Customer referral widget

You need import our css to your root file:

import customerReferralStyle from '@secomus/uppromote-hydrogen/dist/styles/customer-referral.css'

...

export function links() {
   return [
      {rel: 'stylesheet', href: customerReferralStyle},
      ...
   ]
}