Give & Get Example - Packages

On our site, we've installed: 

  • The jsonwebtoken npm package to encrypt and decrypt giveaway IDs that we send to the (fictitious) delivery service.
  • The @velo/wix-animation-helper Velo package to create a spinning animation on the Home page.

npm Package

When we send a giveaway ID to the delivery service we use the jsonwebtoken npm package to encrypt the ID before sending it. We create a callback URL that includes the encrypted ID. The delivery service will use this URL to let us know the giveaway has been delivered.

Copy

Then, when the delivery service lets us know that the giveaway has been delivered, we decrypt the ID so we can update the delivered giveaway's data in the Giveaways collection.

Copy

Velo Package

Towards the bottom of the Home page, we add a little pizzazz to our site by creating some text that rotates around our logo. Thanks to the wix-animation-helper Velo package we can create this effect with a single import and one line of code.

Copy

We start by importing the spin() function from the Velo package.

Copy

Then, inside the onReady event handler, we simply call the rotate function. When we call it, we pass the element that we want to spin and how long, in milliseconds, each rotation should take.

Copy
Did this help?