Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Node.js 18 and bump all NPM dev dependencies #345

Merged
merged 3 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14
v18
38 changes: 19 additions & 19 deletions assets/js/src/tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ let currentStep = -1;
/**
* Tracks view_item_list event
*
* @param {Object} params The function params
* @param {Array} params.products The products to track
* @param {Object} params The function params
* @param {Array} params.products The products to track
* @param {string} [params.listName] The name of the list in which the item was presented to the user.
*/
export const trackListProducts = ( {
Expand All @@ -39,8 +39,8 @@ export const trackListProducts = ( {
/**
* Tracks add_to_cart event
*
* @param {Object} params The function params
* @param {Array} params.product The product to track
* @param {Object} params The function params
* @param {Array} params.product The product to track
* @param {number} [params.quantity=1] The quantity of that product in the cart.
*/
export const trackAddToCart = ( { product, quantity = 1 } ) => {
Expand All @@ -57,8 +57,8 @@ export const trackAddToCart = ( { product, quantity = 1 } ) => {
/**
* Tracks remove_from_cart event
*
* @param {Object} params The function params
* @param {Array} params.product The product to track
* @param {Object} params The function params
* @param {Array} params.product The product to track
* @param {number} [params.quantity=1] The quantity of that product in the cart.
*/
export const trackRemoveCartItem = ( { product, quantity = 1 } ) => {
Expand All @@ -75,8 +75,8 @@ export const trackRemoveCartItem = ( { product, quantity = 1 } ) => {
/**
* Tracks change_cart_quantity event
*
* @param {Object} params The function params
* @param {Array} params.product The product to track
* @param {Object} params The function params
* @param {Array} params.product The product to track
* @param {number} [params.quantity=1] The quantity of that product in the cart.
*/
export const trackChangeCartItemQuantity = ( { product, quantity = 1 } ) => {
Expand Down Expand Up @@ -133,10 +133,10 @@ export const trackCheckoutStep =
* Track a set_checkout_option event
* Notice calling this will set the current checkout step as the step provided in the parameter.
*
* @param {Object} params The params from the option.
* @param {number} params.step The step to track
* @param {Object} params The params from the option.
* @param {number} params.step The step to track
* @param {string} params.option The option to set in checkout
* @param {string} params.value The value for the option
* @param {string} params.value The value for the option
*
* @return {(function() : void)} A callable to track the checkout event.
*/
Expand All @@ -155,8 +155,8 @@ export const trackCheckoutOption =
/**
* Tracks select_content event.
*
* @param {Object} params The function params
* @param {Object} params.product The product to track
* @param {Object} params The function params
* @param {Object} params.product The product to track
* @param {string} params.listName The name of the list in which the item was presented to the user.
*/
export const trackSelectContent = ( {
Expand All @@ -172,7 +172,7 @@ export const trackSelectContent = ( {
/**
* Tracks search event.
*
* @param {Object} params The function params
* @param {Object} params The function params
* @param {string} params.searchTerm The search term to track
*/
export const trackSearch = ( { searchTerm } ) => {
Expand All @@ -184,8 +184,8 @@ export const trackSearch = ( { searchTerm } ) => {
/**
* Tracks view_item event
*
* @param {Object} params The function params
* @param {Object} params.product The product to track
* @param {Object} params The function params
* @param {Object} params.product The product to track
* @param {string} [params.listName] The name of the list in which the item was presented to the user.
*/
export const trackViewItem = ( {
Expand All @@ -202,8 +202,8 @@ export const trackViewItem = ( {
/**
* Track exception event
*
* @param {Object} params The function params
* @param {string} params.status The status of the exception. It should be "error" for tracking it.
* @param {Object} params The function params
* @param {string} params.status The status of the exception. It should be "error" for tracking it.
* @param {string} params.content The exception description
*/
export const trackException = ( { status, content } ) => {
Expand All @@ -218,7 +218,7 @@ export const trackException = ( { status, content } ) => {
/**
* Track an event using the global gtag function.
*
* @param {string} eventName - Name of the event to track
* @param {string} eventName - Name of the event to track
* @param {Object} [eventParams] - Props to send within the event
*/
export const trackEvent = ( eventName, eventParams ) => {
Expand Down
12 changes: 6 additions & 6 deletions assets/js/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { addAction, removeAction } from '@wordpress/hooks';
* Formats data into the productFieldObject shape.
*
* @see https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce#product-data
* @param {Object} product - The product data
* @param {Object} product - The product data
* @param {number} quantity - The product quantity
*
* @return {Object} The product data
Expand All @@ -26,7 +26,7 @@ export const getProductFieldObject = ( product, quantity ) => {
* Formats data into the impressionFieldObject shape.
*
* @see https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce#impression-data
* @param {Object} product - The product data
* @param {Object} product - The product data
* @param {string} listName - The list for this product
*
* @return {Object} - The product impression data
Expand All @@ -47,7 +47,7 @@ export const getProductImpressionObject = ( product, listName ) => {
/**
* Returns the price of a product formatted as a string.
*
* @param {string} price - The price to parse
* @param {string} price - The price to parse
* @param {number} [currencyMinorUnit=2] - The number decimals to show in the currency
*
* @return {string} - The price of the product formatted
Expand All @@ -59,9 +59,9 @@ export const formatPrice = ( price, currencyMinorUnit = 2 ) => {
/**
* Removes previous actions with the same hookName and namespace and then adds the new action.
*
* @param {string} hookName The hook name for the action
* @param {string} namespace The unique namespace for the action
* @param {Function} callback The function to run when the action happens.
* @param {string} hookName The hook name for the action
* @param {string} namespace The unique namespace for the action
* @param {Function} callback The function to run when the action happens.
*/
export const addUniqueAction = ( hookName, namespace, callback ) => {
removeAction( hookName, namespace );
Expand Down
Loading
Loading