-
Notifications
You must be signed in to change notification settings - Fork 58
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
Contact Info jetpack native blocks behind DEV flag #1934
Changes from all commits
369c173
4527d76
99fb15a
d1c4d90
9a52618
ded8fff
2cbb7a6
d5c1c95
81d7799
b3c364c
98d5259
ce92adf
064013a
96d86b9
6bfa3ab
cb97bae
f0d0b84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ symlinked-packages | |
symlinked-packages-in-parent | ||
react-native-aztec | ||
bundle | ||
jetpack |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "gutenberg"] | ||
path = gutenberg | ||
url = ../../WordPress/gutenberg.git | ||
[submodule "jetpack"] | ||
path = jetpack | ||
url = ../../Automattic/jetpack.git |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** @format */ | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { JETPACK_DATA_PATH } from '../jetpack/extensions/shared/get-jetpack-data'; | ||
|
||
const supportedJetpackBlocks = { | ||
'contact-info': { | ||
available: true, | ||
}, | ||
}; | ||
|
||
const setJetpackData = ( { | ||
isJetpackActive = false, | ||
userData = null, | ||
siteFragment = null, | ||
blogId, | ||
} ) => { | ||
const availableBlocks = supportedJetpackBlocks; | ||
const jetpackEditorInitialState = { | ||
available_blocks: availableBlocks, | ||
jetpack: { | ||
is_active: isJetpackActive, | ||
}, | ||
siteFragment, | ||
tracksUserData: userData, | ||
wpcomBlogId: blogId, | ||
}; | ||
global.window[ JETPACK_DATA_PATH ] = jetpackEditorInitialState; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just want to ask you @Tug about this line since it's hard to understand with the API calls temporarily disabled. Are we utilizing |
||
return jetpackEditorInitialState; | ||
}; | ||
|
||
export default ( jetpackState ) => { | ||
if ( ! jetpackState.isJetpackActive ) { | ||
return; | ||
} | ||
|
||
const jetpackData = setJetpackData( jetpackState ); | ||
|
||
if ( __DEV__ ) { | ||
require( '../jetpack/extensions/editor' ); | ||
} | ||
|
||
return jetpackData; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6430,6 +6430,11 @@ elliptic@^6.0.0: | |
minimalistic-assert "^1.0.0" | ||
minimalistic-crypto-utils "^1.0.0" | ||
|
||
[email protected]: | ||
version "2.0.4" | ||
resolved "https://registry.yarnpkg.com/email-validator/-/email-validator-2.0.4.tgz#b8dfaa5d0dae28f1b03c95881d904d4e40bfe7ed" | ||
integrity sha512-gYCwo7kh5S3IDyZPLZf6hSS0MnZT8QmJFqYvbqlDZSbwdZlY6QZWxJ4i/6UhITOJ4XzyI647Bm2MXKCLqnJ4nQ== | ||
|
||
emitter-listener@^1.1.1: | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/emitter-listener/-/emitter-listener-1.1.2.tgz#56b140e8f6992375b3d7cb2cab1cc7432d9632e8" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll have to make this async when we actually fetch the data from the site, but for now let's keep it that way 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Just going to note here that if we make an async call to check if we're enabling jetpack blocks, then we need to block the action of parsing raw html to blocks until after that function returns, otherwise jetpack blocks will show up as not enabled, even if api response says they should be enabled.