-
Notifications
You must be signed in to change notification settings - Fork 48
Adding optional prop for lazy load the intercom script #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bb29b5e
Adding optional prop for lazy load the intercom script
Siggnja 97186f9
Adding types and passing the delay to the initialize function
Siggnja 4b353ec
Adding types and passing the delay to the initialize function
Siggnja 354d8f5
Merge branches 'implement-timeout-support' and 'implement-timeout-sup…
devrnt c1c3357
chore: update initialize jsdoc
devrnt 38bbd84
Adding types and passing the delay to the initialize function
Siggnja 25454c1
chore: update initialize jsdoc
devrnt ef59f9d
Updating variable names and jsdoc
Siggnja d9c382d
Adding delay intercom test
Siggnja 828866a
Merge branch 'implement-timeout-support' of github.com:Siggnja/react-…
devrnt 8a6b740
chore: run linter in test
devrnt b3e1760
test: rephrase test case
devrnt 112826c
chore: use correct typescript function type
devrnt 7cbe92c
docs: add delay initialization section in readme
devrnt 1ddadcd
Removing unused variables and improving the description of the delay …
Siggnja 3a7c6c4
chore: format playground
devrnt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as UseIntercomPage } from './useIntercom'; | ||
export { default as UseIntercomTourPage } from './useIntercomTour'; | ||
export { default as UseIntercomWithDelay } from './useIntercomWithDelay' |
This file contains hidden or 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,51 @@ | ||
import * as React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { IntercomProvider, useIntercom } from '../../../.'; | ||
|
||
import { Button } from '../common'; | ||
|
||
const Grid = styled.div` | ||
display: grid; | ||
grid-template-columns: repeat(1, 1fr); | ||
width: 100%; | ||
`; | ||
|
||
const Item = styled.div` | ||
display: grid; | ||
grid-template-rows: min-content; | ||
|
||
&::after { | ||
content: ''; | ||
margin: 2rem 0 1.5rem; | ||
border-bottom: 2px solid var(--grey); | ||
width: 100%; | ||
} | ||
`; | ||
|
||
const RawUseIntercomPage = () => { | ||
const { | ||
boot, | ||
} = useIntercom(); | ||
const handleBoot = React.useCallback(() => boot(), [boot]); | ||
|
||
return ( | ||
<Grid> | ||
<Item> | ||
<p> | ||
Intercom will be autobooted after 5000ms | ||
</p> | ||
</Item> | ||
</Grid> | ||
); | ||
}; | ||
|
||
const UseIntercomWithDelayPage = () => { | ||
return ( | ||
<IntercomProvider appId="jcabc7e3" initializeDelay={5000} autoBoot> | ||
<RawUseIntercomPage /> | ||
</IntercomProvider> | ||
); | ||
}; | ||
|
||
export default UseIntercomWithDelayPage; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.