-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
531 additions
and
234 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
_theme_dev/src/css/theme/components/_cart-preview-content.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
.cart-preview-content { | ||
$self: &; | ||
|
||
&--dropdown { | ||
#{$self} { | ||
&__products { | ||
max-height: rem-calc(300px); | ||
overflow-y: auto; | ||
overflow-x: hidden; | ||
} | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
_theme_dev/src/css/theme/components/_cart-preview-dropdown.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
.cart-preview-dropdown { | ||
width: rem-calc(320px); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@import "cart-preview-dropdown"; | ||
@import "cart-preview-content"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@import "@themeAbstract"; | ||
@import "components"; | ||
|
16 changes: 16 additions & 0 deletions
16
_theme_dev/src/js/theme/handler/closePreviewDropdownHandler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const closePreviewDropdownHandler = (e) => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
|
||
const target = e.delegateTarget?.dataset?.target; | ||
|
||
if (target) { | ||
const dropdown = document.querySelector(target); | ||
|
||
if (dropdown) { | ||
bootstrap.Dropdown.getOrCreateInstance(dropdown).hide(); | ||
} | ||
} | ||
} | ||
|
||
export default closePreviewDropdownHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
const openNotificationHandler = (resp) => { | ||
|
||
} | ||
|
||
export default openNotificationHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import updatePreviewCartRequest from "../request/updatePreviewCartRequest"; | ||
|
||
const updateCartHandler = (event) => { | ||
debugger | ||
Check failure on line 4 in _theme_dev/src/js/theme/handler/updateCartHandler.js GitHub Actions / Code quality - ESLint
|
||
if (!event?.reason || !event?.resp || event?.resp?.hasError) { | ||
return; | ||
} | ||
|
||
const payload = { | ||
id_customization: event.reason.idCustomization, | ||
id_product_attribute: event.reason.idProductAttribute, | ||
id_product: event.reason.idProduct, | ||
action: event.reason.linkAction, | ||
}; | ||
|
||
// refreshCartPreviewUrl is defined as a global variable in the module | ||
const { getRequest } = updatePreviewCartRequest(refreshCartPreviewUrl, payload); | ||
|
||
getRequest() | ||
.then((resp) => { | ||
prestashop.emit('updatedCartPreview', resp); | ||
}) | ||
.catch((resp) => { | ||
prestashop.emit('handleError', { eventType: 'updateShoppingCart', resp }); | ||
}); | ||
} | ||
|
||
export default updateCartHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
_theme_dev/src/js/theme/request/updatePreviewCartRequest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import useHttpRequest from '@js/utils/http/useHttpRequest'; | ||
|
||
const updatePreviewCartRequest = (url, payload = {}) => { | ||
const { request } = useHttpRequest(url); | ||
|
||
/** | ||
* Executes the request to get the preview cart. | ||
* @function | ||
* @memberof updatePreviewCartRequest | ||
* @return {Promise<Object>} A Promise that resolves with the response data. | ||
*/ | ||
const getRequest = () => new Promise((resolve) => { | ||
request | ||
.query(payload) | ||
.post() | ||
.json((resp) => { | ||
resolve(resp); | ||
}); | ||
}); | ||
|
||
return { | ||
getRequest, | ||
}; | ||
}; | ||
|
||
export default updatePreviewCartRequest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
const selectorsMap = { | ||
cartPreviewBtn: '.js-cart-preview-btn', | ||
cartPreview: '.js-cart-preview', | ||
cartPreviewContent: '.js-cart-preview-content', | ||
cartDropdownClose: '.js-close-cart-dropdown', | ||
} | ||
|
||
export default selectorsMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Oksydan\IsShoppingcart\Configuration; | ||
|
||
class NotificationsTypes | ||
{ | ||
public const NOTIFICATION_TYPE_TOAST = 'toast'; | ||
|
||
public const NOTIFICATION_TYPE_MODAL = 'modal'; | ||
|
||
public const NOTIFICATION_TYPE_NONE = 'none'; | ||
|
||
public static function getTypes(): array | ||
{ | ||
return [ | ||
self::NOTIFICATION_TYPE_TOAST, | ||
self::NOTIFICATION_TYPE_MODAL, | ||
self::NOTIFICATION_TYPE_NONE, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Oksydan\IsShoppingcart\Configuration; | ||
|
||
class PreviewTypes | ||
{ | ||
public const PREVIEW_TYPE_OFFCANVAS = 'offcanvas'; | ||
public const PREVIEW_TYPE_DROPDOWN = 'dropdown'; | ||
|
||
public static function getTypes(): array | ||
{ | ||
return [ | ||
self::PREVIEW_TYPE_OFFCANVAS, | ||
self::PREVIEW_TYPE_DROPDOWN, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.