Skip to content
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

✨Introduce varGroups for configRewriter. #20190

Merged
merged 10 commits into from Jan 15, 2019
Merged

✨Introduce varGroups for configRewriter. #20190

merged 10 commits into from Jan 15, 2019

Conversation

calebcordry
Copy link
Member

@calebcordry calebcordry commented Jan 8, 2019

Vendor API

'configRewriter': {
  'url': 'https://www.amp.dev/rewriter',
  'varGroups': {
    'feature1': {
      'dr': 'DOCUMENT_REFERRER',
      'su': 'SOURCE_URL',
    }
   'feature2': {
      'id: '12345'
    }
  }

Publisher API

"configRewriter": {
  "varGroups": {
    "feature1": {
      "enabled": true
    }
    "feature2": {
      "enabled": true
    }
  }
}

Payload

"configRewriter": {
  "vars": {
    "dr": "www.example.com"
    "su": "www.foo.com"
    "id": "12345"
  }
}

Also introduces mock vendor that can be used for examples and local testing.

Copy link
Contributor

@lannka lannka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed offline, it will be good to have a integration test first , so that we're confident about any new changes.

extensions/amp-analytics/0.1/vendors.js Outdated Show resolved Hide resolved
extensions/amp-analytics/0.1/vendors/mock.js Outdated Show resolved Hide resolved
@calebcordry
Copy link
Member Author

Ok this should be ready for another round of review 😀

Copy link
Contributor

@lannka lannka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zikas FYI

extensions/amp-analytics/0.1/config.js Outdated Show resolved Hide resolved
@calebcordry
Copy link
Member Author

@lannka this wound up being a decent size refactor (also added some more tests) PTAL.

Now we have 2 options where either pub or vendor can enable this feature. Also made sure we delete the configRewriter.vars obj if nothing has been enabled.

@calebcordry calebcordry merged commit 41f87fe into ampproject:master Jan 15, 2019
@calebcordry calebcordry deleted the var-groups branch January 25, 2019 23:16
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request Mar 22, 2019
* add vargroups

* move varGroups to its own method

* write test

* jsdoc

* separate out fake config

* add integration and error handling

* presubmit checks

* comments

* fix types

* allow vendors to enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants