From e11f6bc4a75767178c9a6fc5bf14a654a2a14ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Ste=CC=A8pien=CC=81?= Date: Mon, 2 Oct 2023 02:58:41 +0200 Subject: [PATCH] jsdocs fixes --- .../updateProductCustomizationHandler.js | 8 ++++++++ .../updateProductDOMElementsHandler.js | 20 +++++++++++++++++++ .../product/updateQuantityInputHandler.js | 6 ++++++ .../request/product/updateProductRequest.js | 19 ++++++++++++++++-- 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/_dev/js/theme/core/product/handler/product/updateProductCustomizationHandler.js b/_dev/js/theme/core/product/handler/product/updateProductCustomizationHandler.js index f88dccc0..48d3d692 100644 --- a/_dev/js/theme/core/product/handler/product/updateProductCustomizationHandler.js +++ b/_dev/js/theme/core/product/handler/product/updateProductCustomizationHandler.js @@ -1,5 +1,13 @@ import prestashop from 'prestashop'; +/** + * Update product customization input value + * Side effect: update product customization input value + * @param eventType {string} - event type + * @param eventData {object} - event data + * @param eventData.id_customization {number} - customization id + * @return {void} + */ const updateProductCustomizationHandler = (eventType, { id_customization: idCustomization }) => { const customizationIdInput = document.querySelector(prestashop.selectors.cart.productCustomizationId); diff --git a/_dev/js/theme/core/product/handler/product/updateProductDOMElementsHandler.js b/_dev/js/theme/core/product/handler/product/updateProductDOMElementsHandler.js index fa115135..160468a9 100644 --- a/_dev/js/theme/core/product/handler/product/updateProductDOMElementsHandler.js +++ b/_dev/js/theme/core/product/handler/product/updateProductDOMElementsHandler.js @@ -2,12 +2,32 @@ import prestashop from 'prestashop'; import parseToHtml from '../../../../utils/parseToHtml'; import { each } from '../../../../utils/DOMHelpers'; +/** + * Replace element with new html string + * @param element {HTMLElement} - element to replace + * @param htmlString {string} - html string to replace with + */ const replaceElement = (element, htmlString) => { const newElement = parseToHtml(htmlString); element.replaceWith(newElement); }; +/** + * Update DOM elements of the product page + * Side effect: update DOM elements of the product page + * @param eventData {object} - event data + * @param eventData.product_cover_thumbnails {string} - product cover thumbnails html string + * @param eventData.product_prices {string} - product prices html string + * @param eventData.product_customization {string} - product customization html string + * @param eventData.product_variants {string} - product variants html string + * @param eventData.product_discounts {string} - product discounts html string + * @param eventData.product_additional_info {string} - product additional info html string + * @param eventData.product_details {string} - product details html string + * @param eventData.product_flags {string} - product flags html string + * @param eventData.product_add_to_cart {string} - product add to cart html string + * @return {void} + */ const updateProductDOMElementsHandler = ({ /* eslint-disable */ product_cover_thumbnails, diff --git a/_dev/js/theme/core/product/handler/product/updateQuantityInputHandler.js b/_dev/js/theme/core/product/handler/product/updateQuantityInputHandler.js index d0fffc53..9339378d 100644 --- a/_dev/js/theme/core/product/handler/product/updateQuantityInputHandler.js +++ b/_dev/js/theme/core/product/handler/product/updateQuantityInputHandler.js @@ -1,5 +1,11 @@ import prestashop from 'prestashop'; +/** + * Update quantity input value + * @param eventType {string} - event type + * @param event {object} - event data + * @param event.product_minimal_quantity {number} - product minimal quantity + */ const updateQuantityInputHandler = (eventType, { product_minimal_quantity: productMinimalQuantity }) => { const minimalProductQuantity = parseInt( productMinimalQuantity, diff --git a/_dev/js/theme/core/product/request/product/updateProductRequest.js b/_dev/js/theme/core/product/request/product/updateProductRequest.js index c8c4dc9b..62da2d93 100644 --- a/_dev/js/theme/core/product/request/product/updateProductRequest.js +++ b/_dev/js/theme/core/product/request/product/updateProductRequest.js @@ -8,7 +8,23 @@ const { dispatch, abortAll } = useHttpController(); /** * @typedef ServerResponse * @type {object} - * @property {string} address_form - new address form html content + * @property {number} id_customization - saved customization id + * @property {number} id_product_attribute - saved product attribute id + * @property {number} product_minimal_quantity - product minimal quantity + * @property {boolean} is_quick_view - is quick view + * @property {boolean} product_has_combinations - product has combinations + * @property {string} product_url - product url address + * @property {string} product_title - product meta title + * @property {string} product_add_to_cart - product add to cart html content + * @property {string} product_additional_info - product additional info html content + * @property {string} product_cover_thumbnails - product cover thumbnails html content + * @property {string} product_customization - product customization html content + * @property {string} product_details - product details html content + * @property {string} product_discounts - product discounts html content + * @property {string} product_flags - product flags html content + * @property {string} product_prices - product prices html content + * @property {string} product_images_modal - product images modal html content + * @property {string} product_variants - product variants html content */ /** @@ -24,7 +40,6 @@ const { dispatch, abortAll } = useHttpController(); * @param payload.action {string} - optional, default refresh * @param payload.group[] {array} - array of attributes groups - optional * @example - * const url = 'address-form.com/url'; // url to update address form * const payload = { * id_product: 1, * id_product_attribute: 1,