-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added settings option to hide price (#41)
#### What problem is this solving? Added setting option to hide price for b2b stores #### How to test it? Check PDP in following workspace [Workspace](https://jorgeopengraph--renwil.myvtex.com/hopper-lpt1173/p?__bindingAddress=www.renwil.com/en) #### Screenshots or example usage: <img width="1076" alt="image" src="https://github.com/vtex-apps/open-graph/assets/94565086/6620926f-cfb1-4da2-a214-b07d53f6c80a"> --------- Co-authored-by: Jorge Acosta <[email protected]>
- Loading branch information
1 parent
6874854
commit 9aed2ad
Showing
5 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
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,27 @@ | ||
import { useQuery } from 'react-apollo' | ||
|
||
import GET_SETTINGS from '../queries/getSettings.graphql' | ||
|
||
const DEFAULT_DISABLE_OFFERS = false | ||
|
||
interface Settings { | ||
disableOffers: boolean | ||
} | ||
|
||
const useAppSettings = (): Settings => { | ||
const { data } = useQuery(GET_SETTINGS, { ssr: false }) | ||
|
||
if (data?.publicSettingsForApp?.message) { | ||
const { disableOffers } = JSON.parse(data.publicSettingsForApp.message) | ||
|
||
return { | ||
disableOffers: disableOffers || DEFAULT_DISABLE_OFFERS, | ||
} | ||
} | ||
|
||
return { | ||
disableOffers: DEFAULT_DISABLE_OFFERS, | ||
} | ||
} | ||
|
||
export default useAppSettings |
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 @@ | ||
query getSettings { | ||
publicSettingsForApp(app: "vtex.open-graph", version: "1.x") | ||
@context(provider: "vtex.apps-graphql") { | ||
message | ||
} | ||
} |