Skip to content

Commit

Permalink
fix: permission button
Browse files Browse the repository at this point in the history
  • Loading branch information
kris-liu-smile authored and CarlLiu2023 committed Apr 10, 2023
1 parent 74aa3cb commit 16fdda1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ export const B3HoverButton = (props: B3HoverButtonProps) => {
<Snackbar
sx={{
zIndex: '110000',
right: '20px',
bottom: '20px',
left: 'auto',
width: 'auto',
}}
anchorOrigin={getLocation(location) || defaultLocation}
open
Expand All @@ -103,8 +101,7 @@ export const B3HoverButton = (props: B3HoverButtonProps) => {
sx={{
display: 'flex',
flexDirection: 'column',
width: '100%',
alignItems: 'flex-end',
width: 'auto',
}}
>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,9 @@ export const B3MasquradeGobalTip = (props: B3MasquradeGobalTipProps) => {
<Snackbar
sx={{
zIndex: '110000',
left: '20px',
bottom: '20px',
right: 'auto',
// right: 'auto',
}}
anchorOrigin={defaultLocation}
anchorOrigin={getLocation(location) || defaultLocation}
open
>

Expand All @@ -175,6 +173,7 @@ export const B3MasquradeGobalTip = (props: B3MasquradeGobalTipProps) => {
backgroundColor: '#ED6C02',
height: '42px',
marginTop: '10px',
...customStyles,
}}
onClick={() => {
setOpenPage({
Expand Down Expand Up @@ -300,7 +299,6 @@ export const B3MasquradeGobalTip = (props: B3MasquradeGobalTipProps) => {
height: '52px',
color: '#FFFFFF',
...sx,
...customStyles,
}}
anchorOrigin={getLocation(location) || defaultLocation}
open
Expand Down
4 changes: 3 additions & 1 deletion apps/storefront/src/hooks/dom/useOpenPDP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ const useOpenPDP = ({
return
}

if (shoppingListEnabled && enabled) {
const isCurrentUserEnabled = roleText ? (shoppingListBtn as CustomFieldItems)[roleText] : ''

if (shoppingListEnabled && enabled && isCurrentUserEnabled) {
addToCartAll.forEach((node: CustomFieldItems) => {
shoppingBtnDom = document.createElement('div')
shoppingBtnDom.setAttribute('id', `${locationSelector}`)
Expand Down
5 changes: 1 addition & 4 deletions apps/storefront/src/utils/b3Init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const getQuoteEnabled = (

const quoteEnabled = storefrontConfig.quotes || false

let shoppingListEnabled = storefrontConfig.shoppingLists || false
const shoppingListEnabled = storefrontConfig.shoppingLists

quoteConfig.forEach((config) => {
if (config.key === 'quote_customer') {
Expand All @@ -42,7 +42,6 @@ export const getQuoteEnabled = (
if (config.key === 'quote_for_individual_customer') {
bcUserEnabled = config.value
}
// TODO: check
if (config.key === 'quote_for_b2b') {
b2bUserEnabled = config.value
}
Expand All @@ -60,14 +59,12 @@ export const getQuoteEnabled = (
if (`${role}` === '100') { // guest
productQuoteEnabled = productQuoteEnabled && guestEnabled === '1'
cartQuoteEnabled = cartQuoteEnabled && guestEnabled === '1'
shoppingListEnabled = false
} else if (isB2BUser) {
productQuoteEnabled = b2bUserEnabled === '1'
cartQuoteEnabled = b2bUserEnabled === '1'
if (`${role}` === '3' && !isAgenting) {
productQuoteEnabled = false
cartQuoteEnabled = false
shoppingListEnabled = false
}
} else if (!isB2BUser) { // BCUser
productQuoteEnabled = productQuoteEnabled && bcUserEnabled === '1'
Expand Down
2 changes: 0 additions & 2 deletions apps/storefront/src/utils/storefrontConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ const getTemPlateConfig = async (channelId: number, dispatch: any, dispatchGloba
}
})

console.log(storefrontConfigs, logo, 'storefrontConfigs')

dispatchGlobal({
type: 'common',
payload: {
Expand Down

0 comments on commit 16fdda1

Please sign in to comment.