Skip to content

Commit

Permalink
jsdocs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Oksydan committed Oct 2, 2023
1 parent 095112b commit e11f6bc
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
19 changes: 17 additions & 2 deletions _dev/js/theme/core/product/request/product/updateProductRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

/**
Expand All @@ -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,
Expand Down

0 comments on commit e11f6bc

Please sign in to comment.