-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
✨ Create whitelist for amp-viewer-assistance.updateActionState actionStatus #21630
✨ Create whitelist for amp-viewer-assistance.updateActionState actionStatus #21630
Conversation
Change-Id: I9aeff992b2cde5215463a1f4ad717f7426818498
Change-Id: I9147bfe84b34bbe5ed0e86c59155cdf51e972cc6
*/ | ||
isValidActionStatusArgs_(args) { | ||
const update = args['update']; | ||
if (!update || !update['actionStatus']) { |
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.
Hm, not sure we support object literals outside of AMP.setState (syntax). What would this look like in HTML?
<!-- Is this the intention? -->
<button on="tap:amp-viewer-assistance.updateActionStatus(update={actionStatus: ACTIVE_ACTION_STATUS})">
<!--
Or maybe we can do this (case-insensitive)?
Uppercase and append "_ACTION_STATUS" before sending viewer message.
-->
<button on="tap:amp-viewer-assistance.updateActionStatus(status=active)">
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.
The first example is how it's usually implemented except with the payload being passed from an event:
<form id="my-form"
action-xhr="some/XHR"
on="submit-success:amp-viewer-assistance.updateActionState(update=event.response.result)">
</form>
It's also important to note that the update
payload can include additional data in another field (usually result
), but it is too complex to validate on the run-time side.
{
'actionStatus': 'COMPLETED_ACTION_STATUS',
'result': { ... }
}
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.
I see, thanks.
*/ | ||
isValidActionStatusArgs_(args) { | ||
const update = args['update']; | ||
if (!update || !update['actionStatus']) { |
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.
I see, thanks.
Change-Id: I4673794d9e0a469e1bf5ee7a755682b40f8ae300
In response to this discussion comment, I created a whitelist for valid action statuses that can be passed via
amp-viewer-assistance
andupdateActionState
./cc @choumx