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
✨ AoG: Add amp-viewer-assistance extension. #20725
✨ AoG: Add amp-viewer-assistance extension. #20725
Conversation
Change-Id: I78dac3ec9f85c3bbd1ceb4ce88a61b3f7d0dc539
extensions/amp-viewer-assistance/validator-viewer-assistance.protoascii
Outdated
Show resolved
Hide resolved
extensions/amp-viewer-assistance/validator-viewer-assistance.protoascii
Outdated
Show resolved
Hide resolved
extensions/amp-viewer-assistance/validator-viewer-assistance.protoascii
Outdated
Show resolved
Hide resolved
extensions/amp-viewer-assistance/validator-viewer-assistance.protoascii
Outdated
Show resolved
Hide resolved
extensions/amp-viewer-assistance/validator-viewer-assistance.protoascii
Outdated
Show resolved
Hide resolved
Change-Id: I874c096e75e9428872b6609df4acb75a82ee5b09
Change-Id: I6692ccec7eaccfce9227115c1ebca24b3a5fe118
Change-Id: I3d282f2571cc48e388ddd222676a23ed0d61b67b
Change-Id: I5335d7d63843800a88319d760504fef7caab4d4f
Change-Id: If066222b53ed7912140c1e526e231aca43d9a38c
# amp-viewer-assistance | ||
|
||
The amp-viewer-assistance element provides specification of AMP viewer | ||
configuration information and invocation of AMP viewer assisted behavior. |
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.
This documentation needs some love. :)
We ought to:
- Clearly describe the high-level product use case. E.g. this is meant for "assistive behaviors on AMP pages, facilitated by the viewer."
- Document AMP page/viewer API contract e.g. "requestSignIn".
- Document element actions like "signIn" and "updateActionState".
- Follow the format from other extension documentation (see amp-access.md).
/cc @CrystalOnScript
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.
Agreed! More documentation will be committed to this PR soon.
P.S. That is a very nice way of requesting for more documentation! 👍 😄
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.
Just updated the documentation to address some of those comments.
} | ||
return this.viewer_.isTrustedViewer().then(isTrustedViewer => { | ||
if (!isTrustedViewer && | ||
!isExperimentOn(this.ampdoc_.win, 'amp-viewer-assistance-untrusted')) { |
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.
Is this intended to be enabled eventually?
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.
No, the experiment was our method of forgoing the trusted viewer check with testing locally since local viewers are inherently not trusted.
If there are other ways of accomplishing the same effect, we are open to suggestions.
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.
Ah, we usually use getMode().localDev
for this. It returns true when compiling with --fortesting
flag, e.g. gulp dist --extensions=amp-viewer-assistance --fortesting
.
Though if you don't do testing with a locally-build AMP runtime, then you'd need local proxy software like Charles to replace the CDN-fetched JS with your local version. Is that the case?
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.
Yes, this is specifically for developing/testing with a local viewer using a remote (or local) runtime. Does that make sense?
Change-Id: I1c06c45a2159fcb5286db2a36e168907073a77fa
Change-Id: I9031cc6930c18de3ca691f41274f868670b72c7a
Friendly ping. |
extensions/amp-viewer-assistance/validator-viewer-assistance.protoascii
Outdated
Show resolved
Hide resolved
extensions/amp-viewer-assistance/0.1/test/validator-amp-viewer-assistance.html
Outdated
Show resolved
Hide resolved
extensions/amp-viewer-assistance/0.1/test/validator-amp-viewer-assistance.out
Outdated
Show resolved
Hide resolved
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the Googlers can find more info about SignCLA and this PR by following this link. |
Change-Id: I5c3194a511b64321500025e59375f618ed4660a4
0e164be
to
b537af0
Compare
CLAs look good, thanks! Googlers can find more info about SignCLA and this PR by following this link. |
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.
thank you, from validation looks fine. @choumx for other changes which still need approval
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.
Looks good overall. Just one comment and a couple questions.
} | ||
return this.viewer_.isTrustedViewer().then(isTrustedViewer => { | ||
if (!isTrustedViewer && | ||
!isExperimentOn(this.ampdoc_.win, 'amp-viewer-assistance-untrusted')) { |
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.
Ah, we usually use getMode().localDev
for this. It returns true when compiling with --fortesting
flag, e.g. gulp dist --extensions=amp-viewer-assistance --fortesting
.
Though if you don't do testing with a locally-build AMP runtime, then you'd need local proxy software like Charles to replace the CDN-fetched JS with your local version. Is that the case?
Change-Id: Ib20566f920d3c92da648d49dc7dd30fc78eb313f
Change-Id: If962d4a174593b2eed997acfbc01844c0a3b0f72
Change-Id: I65dfc764cb7a1a226b6aac444392f5936b21478d
Change-Id: I78849d7d82c98d3353b2a9ad5a1ed99d5c04e2d4
* @return {?Promise} | ||
* @private | ||
*/ | ||
actionHandler_(invocation) { |
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.
Sorry didn't catch this earlier. You should actually use this.registerAction()
here instead. See base-element.js#registerAction
.
Then you can also remove the whitelisting in presubmit-checks.js
.
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.
As we discussed offline, we are following the pattern set by amp-access to justify using our own action handler since we are using a <script>
tag instead of an <amp-viewer-assistance>
element.
* Add amp-viewer-assistance extension (ampproject#15195). Change-Id: I78dac3ec9f85c3bbd1ceb4ce88a61b3f7d0dc539 * Address PR comments 1. Change-Id: I874c096e75e9428872b6609df4acb75a82ee5b09 * remove amp-viewer-integration styles Change-Id: I6692ccec7eaccfce9227115c1ebca24b3a5fe118 * Fix javascript closure typing. Change-Id: I3d282f2571cc48e388ddd222676a23ed0d61b67b * Add copyright and license comments to amp-viewer-assistance files. Change-Id: I5335d7d63843800a88319d760504fef7caab4d4f * Remove newline. Change-Id: If066222b53ed7912140c1e526e231aca43d9a38c * Address PR comments 2. Change-Id: I1c06c45a2159fcb5286db2a36e168907073a77fa * Update amp-viewer-assistance documentation. Change-Id: I9031cc6930c18de3ca691f41274f868670b72c7a * Remove redundant amp-viewer-assistnace validator files. Change-Id: I5c3194a511b64321500025e59375f618ed4660a4 * Remove amp-viewer-assistance-unstrusted experiement from experiments.js. Change-Id: Ib20566f920d3c92da648d49dc7dd30fc78eb313f * Address amp-viewer-assistance presubmit errors. Change-Id: If962d4a174593b2eed997acfbc01844c0a3b0f72 * Lint. Change-Id: Icaf921248e6f5f7f096c43cde4688d28f4943545 * Fix types. Change-Id: I65dfc764cb7a1a226b6aac444392f5936b21478d * Add expectAsyncConsoleError to catch error message in test. Change-Id: I78849d7d82c98d3353b2a9ad5a1ed99d5c04e2d4
* Add amp-viewer-assistance extension (ampproject#15195). Change-Id: I78dac3ec9f85c3bbd1ceb4ce88a61b3f7d0dc539 * Address PR comments 1. Change-Id: I874c096e75e9428872b6609df4acb75a82ee5b09 * remove amp-viewer-integration styles Change-Id: I6692ccec7eaccfce9227115c1ebca24b3a5fe118 * Fix javascript closure typing. Change-Id: I3d282f2571cc48e388ddd222676a23ed0d61b67b * Add copyright and license comments to amp-viewer-assistance files. Change-Id: I5335d7d63843800a88319d760504fef7caab4d4f * Remove newline. Change-Id: If066222b53ed7912140c1e526e231aca43d9a38c * Address PR comments 2. Change-Id: I1c06c45a2159fcb5286db2a36e168907073a77fa * Update amp-viewer-assistance documentation. Change-Id: I9031cc6930c18de3ca691f41274f868670b72c7a * Remove redundant amp-viewer-assistnace validator files. Change-Id: I5c3194a511b64321500025e59375f618ed4660a4 * Remove amp-viewer-assistance-unstrusted experiement from experiments.js. Change-Id: Ib20566f920d3c92da648d49dc7dd30fc78eb313f * Address amp-viewer-assistance presubmit errors. Change-Id: If962d4a174593b2eed997acfbc01844c0a3b0f72 * Lint. Change-Id: Icaf921248e6f5f7f096c43cde4688d28f4943545 * Fix types. Change-Id: I65dfc764cb7a1a226b6aac444392f5936b21478d * Add expectAsyncConsoleError to catch error message in test. Change-Id: I78849d7d82c98d3353b2a9ad5a1ed99d5c04e2d4
Implements the amp-viewer-assistance extension proposed in Issue (#15195).
The new extension creates a messaging channel between AMP pages and AMP viewers to optimize for flows between the embedded page and the external viewer.
cc @choumx